Skip to content
New issue

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

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

Already on GitHub? # to your account

Avatar fix #240

Merged
merged 2 commits into from
Jan 15, 2025
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
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
Loading