import { cn } from '@/utils/cn' import { colorFromString, initials } from '@/utils/misc' export function Avatar({ name, src, size = 'md', className, online, }: { name: string src?: string size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' className?: string online?: boolean }) { const sizes = { xs: 'h-6 w-6 text-[10px]', sm: 'h-8 w-8 text-xs', md: 'h-10 w-10 text-sm', lg: 'h-12 w-12 text-base', xl: 'h-16 w-16 text-lg', } return ( {src ? ( {name} { event.currentTarget.style.display = 'none' event.currentTarget.nextElementSibling?.classList.remove('hidden') }} /> ) : null} {initials(name)} {online !== undefined && ( )} ) }