import { type JSX, splitProps, Show } from 'solid-js'; import { cn } from '../utils/cn'; export interface AvatarProps extends JSX.HTMLAttributes { src?: string; alt?: string; fallback: string; size?: 'sm' | 'md' | 'lg'; } const sizeClasses = { sm: 'h-6 w-6 text-[10px]', md: 'h-8 w-8 text-xs', lg: 'h-10 w-10 text-sm' }; export function Avatar(props: AvatarProps) { const [local, rest] = splitProps(props, ['src', 'alt', 'fallback', 'size', 'class']); const size = () => local.size ?? 'md'; return (
{local.fallback}}> {local.alt
); }