import type { ImageLoadingStatus } from '@base-ui/react/avatar' import type * as React from 'react' import { Avatar as BaseAvatar } from '@base-ui/react/avatar' import { cn } from '@/utils/classnames' const avatarSizeClasses = { 'xxs': { root: 'size-4', text: 'text-[7px]' }, 'xs': { root: 'size-5', text: 'text-[8px]' }, 'sm': { root: 'size-6', text: 'text-[10px]' }, 'md': { root: 'size-8', text: 'text-xs' }, 'lg': { root: 'size-9', text: 'text-sm' }, 'xl': { root: 'size-10', text: 'text-base' }, '2xl': { root: 'size-12', text: 'text-xl' }, '3xl': { root: 'size-16', text: 'text-2xl' }, } as const export type AvatarSize = keyof typeof avatarSizeClasses export type AvatarProps = { name: string avatar: string | null size?: AvatarSize className?: string onLoadingStatusChange?: (status: ImageLoadingStatus) => void } type AvatarRootProps = React.ComponentPropsWithRef & { size?: AvatarSize } function AvatarRoot({ size = 'md', className, ...props }: AvatarRootProps) { return ( ) } type AvatarImageProps = React.ComponentPropsWithRef function AvatarImage({ className, ...props }: AvatarImageProps) { return ( ) } type AvatarFallbackProps = React.ComponentPropsWithRef & { size?: AvatarSize } function AvatarFallback({ size = 'md', className, ...props }: AvatarFallbackProps) { return ( ) } export const Avatar = ({ name, avatar, size = 'md', className, onLoadingStatusChange, }: AvatarProps) => { return ( {avatar && ( )} {name?.[0]?.toLocaleUpperCase()} ) }