Skip to content

Commit

Permalink
Use only text for Avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg committed Jan 14, 2025
1 parent 7cf4c23 commit fc48288
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Common/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const Avatar: React.FC<AvatarProps> = ({
className,
icon,
}) => {
const [bgColor] = propColors || (name ? toColor(name) : toColor(""));
const avatarText = name?.match(/[a-zA-Z]/g)?.join("");
const [bgColor] =
propColors || (avatarText ? toColor(avatarText) : toColor(""));
return (
<div
title={name}
Expand Down Expand Up @@ -100,7 +102,7 @@ const Avatar: React.FC<AvatarProps> = ({
dominantBaseline="middle"
alignmentBaseline="middle"
>
{name ? initials(name) : null}
{avatarText ? initials(avatarText) : null}
</text>
</svg>
)}
Expand Down

0 comments on commit fc48288

Please sign in to comment.