Skip to content

Commit

Permalink
Avatar fix (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbien authored Jan 15, 2025
1 parent 3841edb commit c6d6234
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
14 changes: 10 additions & 4 deletions packages/frosted-ui/src/components/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,16 @@ const Avatar = React.forwardRef<AvatarElement, AvatarProps>(
const [status, setStatus] = React.useState<ImageStatus>('idle');
const dataStatus: ImageStatus = imageProps.src ? status : 'idle';

const fallback =
typeof fallbackProp === 'string'
? getInitials(fallbackProp)
: fallbackProp;
const fallback = React.useMemo(() => {
if (typeof fallbackProp !== 'string') return fallbackProp;
try {
return getInitials(fallbackProp);
} catch (error) {
console.error('Error generating initials:', error);
return fallbackProp;
}
}, [fallbackProp]);

return (
<AvatarPrimitive.Root
data-accent-color={color}
Expand Down
7 changes: 0 additions & 7 deletions packages/frosted-ui/src/components/base-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@
position: relative;
background-color: var(--accent-9);
color: var(--accent-9-contrast);
&::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
border: 1px solid var(--black-a2);
}

@media (hover: hover) {
&:where(:hover) {
Expand Down

0 comments on commit c6d6234

Please sign in to comment.