import clsx from 'clsx'; import { toAbsoluteUrl } from '@/utils/Assets'; interface IAvatarsItem { path?: string; filename?: string; fallback?: string; variant?: string; } interface IAvatarsItems extends Array {} interface IAvatarsProps { size?: string; group: IAvatarsItem[]; more?: { variant?: string; number?: number | string; label?: string }; className?: string; } const CommonAvatars = ({ size, group, more, className }: IAvatarsProps) => { const avatarSize = size ? size : 'size-6'; const renderItem = (each: IAvatarsItem, index: number) => { return (
{each.filename || each.path ? ( ) : each.fallback ? ( {each.fallback} ) : null}
); }; return (
{group.map((each, index) => { return renderItem(each, index); })} {more && (
+{more.number || more.label}
)}
); }; export { CommonAvatars, type IAvatarsItem, type IAvatarsItems, type IAvatarsProps };