Skip to content

Commit

Permalink
🐛 fix: fix avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Oct 25, 2023
1 parent a1d2008 commit 61a7efe
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const Avatar = memo<AvatarProps>(
const isImage = Boolean(
avatar && ['/', 'http', 'data:'].some((index) => avatar.startsWith(index)),
);
const isBase64 = Boolean(avatar?.startsWith('data'));
const emoji = useMemo(() => avatar && !isImage && getEmoji(avatar), [avatar]);

const { styles, cx } = useStyles({ background, isEmoji: Boolean(emoji), size });
Expand All @@ -61,12 +60,7 @@ const Avatar = memo<AvatarProps>(
};

return isImage ? (
<AntAvatar
src={isBase64 ? avatar : undefined}
srcSet={isBase64 ? undefined : avatar}
{...avatarProps}
{...props}
/>
<AntAvatar src={avatar} {...avatarProps} {...props} />
) : (
<AntAvatar {...avatarProps} {...props}>
{emoji ? <Emoji emoji={emoji} size={size * 0.8} /> : text?.toUpperCase().slice(0, 2)}
Expand Down

0 comments on commit 61a7efe

Please sign in to comment.