import { jsx as _jsx } from "react/jsx-runtime";
const sizeClasses = {
    sm: 'h-6 w-6 text-[10px]',
    md: 'h-9 w-9 text-xs',
    lg: 'h-12 w-12 text-sm',
};
function getInitials(name) {
    return name
        .split(' ')
        .map((part) => part.charAt(0))
        .join('')
        .toUpperCase()
        .slice(0, 2);
}
export function Avatar({ src, name = '', size = 'md' }) {
    if (src) {
        return (_jsx("img", { src: src, alt: name, className: `inline-block shrink-0 rounded-full object-cover ${sizeClasses[size]}` }));
    }
    return (_jsx("span", { className: `inline-flex shrink-0 items-center justify-center rounded-full bg-[var(--primary)] font-medium text-[var(--primary-foreground)] ${sizeClasses[size]}`, children: getInitials(name) || '?' }));
}
//# sourceMappingURL=Avatar.js.map