Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Avatar): adjust typography usages and sizing for icons #1830

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/components/Avatar/Avatar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,49 @@
}

.avatar--xs {
font: var(--eds-theme-typography-title-xs);
font: var(--eds-theme-typography-tag);

height: var(--eds-size-3);
width: var(--eds-size-3);
}

.avatar--sm {
font: var(--eds-theme-typography-title-sm);
font: var(--eds-theme-typography-title-sm-bold);

height: var(--eds-size-4);
width: var(--eds-size-4);
}

.avatar--md {
font: var(--eds-theme-typography-title-md);
font: var(--eds-theme-typography-title-md-bold);

height: var(--eds-size-5);
width: var(--eds-size-5);
}

.avatar--lg {
font: var(--eds-theme-typography-title-md);
font: var(--eds-theme-typography-title-md-bold);

height: var(--eds-size-6);
width: var(--eds-size-6);
}

.avatar--xl {
font: var(--eds-theme-typography-title-lg);
font: var(--eds-theme-typography-headline-md-bold);

height: var(--eds-size-8);
width: var(--eds-size-8);
}

.avatar--xxl {
font: var(--eds-theme-typography-title-lg);
font: var(--eds-theme-typography-headline-lg-bold);

height: var(--eds-size-12);
width: var(--eds-size-12);
}

.avatar--xxxl {
font: var(--eds-theme-typography-title-lg);
font: var(--eds-theme-typography-headline-lg-bold);

height: calc(var(--eds-size-base-unit) * 20);
width: calc(var(--eds-size-base-unit) * 20);
Expand All @@ -83,6 +83,10 @@
border-radius: var(--eds-border-radius-full);
}

.avatar--square {
border-radius: var(--eds-border-radius-none);
}

.avatar__image {
width: 100%;
}
4 changes: 3 additions & 1 deletion src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export const Avatar = ({
{...other}
>
{variant === 'initials' && avatarDisplayName}
{variant === 'icon' && <Icon name={icon} purpose="decorative" />}
{variant === 'icon' && (
<Icon name={icon} purpose="decorative" size="80%" />
)}
{variant === 'image' && src && (
<img alt="user" className={styles['avatar__image']} src={src} />
)}
Expand Down
27 changes: 27 additions & 0 deletions src/components/Avatar/__snapshots__/Avatar.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ exports[`<Avatar /> ExtraExtraExtraLarge story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -40,7 +43,10 @@ exports[`<Avatar /> ExtraExtraLarge story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -60,7 +66,10 @@ exports[`<Avatar /> ExtraLarge story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -80,7 +89,10 @@ exports[`<Avatar /> ExtraSmall story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -100,7 +112,10 @@ exports[`<Avatar /> Large story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -120,7 +135,10 @@ exports[`<Avatar /> Medium story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -140,7 +158,10 @@ exports[`<Avatar /> Small story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand All @@ -160,7 +181,10 @@ exports[`<Avatar /> Square story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down Expand Up @@ -234,7 +258,10 @@ exports[`<Avatar /> WithCustomIcon story renders snapshot 1`] = `
aria-hidden="true"
class="icon"
fill="currentColor"
height="80%"
style="--icon-size: 80%;"
viewBox="0 0 24 24"
width="80%"
xmlns="http://www.w3.org/2000/svg"
>
<path
Expand Down
Loading