Skip to content

Commit

Permalink
fix: avatar void icon size (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebus-84 authored Aug 26, 2024
1 parent 7e15b66 commit c58a19f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/components/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export class Avatar {
@State() error: boolean = false;

render() {
const sizes = { s: 20, m: 28, l: 48 };
const iconSize:number = sizes[this.size] || 28;
const iconSizes: Record<Size, number> = { 'xs': 16, 's': 24, 'm': 28, 'l': 40, 'xl': 48, '2xl': 56 };

if (this.src && !this.error) {
return (
Expand All @@ -33,7 +32,7 @@ export class Avatar {
const initials = this.generateInitials();
return (
<Host aria-label={this.name} role="figure">
{initials ? <span class="font-medium uppercase">{initials}</span> : <d-icon icon="profile" size={iconSize} />}
{initials ? <span class="font-medium uppercase">{initials}</span> : <d-icon icon="profile" size={iconSizes[this.size]} />}
</Host>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const SizeOptions = 'xs s m l xl 2xl'.split(' ');
const SizeOptions = ['xs', 's', 'm', 'l', 'xl', '2xl'] as const;
export const SizeArgTypes = {
defaultValue: 'm',
options: SizeOptions,
Expand Down

0 comments on commit c58a19f

Please sign in to comment.