diff --git a/src/design-system/components/user-avatar/UserAvatar.tsx b/src/design-system/components/user-avatar/UserAvatar.tsx index f8063dd20..db6c09c1c 100644 --- a/src/design-system/components/user-avatar/UserAvatar.tsx +++ b/src/design-system/components/user-avatar/UserAvatar.tsx @@ -23,7 +23,6 @@ export type UserAvatarProps = BaseUserAvatarProps & Omit type Ref = MuiAvatarProps['ref'] - const UserAvatar = forwardRef( ( { @@ -40,46 +39,62 @@ const UserAvatar = forwardRef( ) => { const monogram = firstName.charAt(0) + lastName.charAt(0) + const avatarClass = cn('s2s-avatar', `s2s-avatar-${size}`) + + let avatarContent + if (variant === 'photo' && src) { + avatarContent = ( + + ) + } else if (variant === 'monogram') { + avatarContent = ( + + {monogram} + + ) + } else if (variant === 'check') { + avatarContent = ( + + + + ) + } else { + avatarContent = ( + + ) + } + return (
- {variant === 'photo' && src ? ( - - ) : variant === 'monogram' ? ( - - {monogram} - - ) : variant === 'check' ? ( - - - - ) : ( - - )} + {avatarContent} {isOnline && ( )}
@@ -88,5 +103,4 @@ const UserAvatar = forwardRef( ) UserAvatar.displayName = 'UserAvatar' - export default UserAvatar