import * as React from "react";
import { cn } from "@/lib/utils";
interface Avatar {
src: string;
alt: string;
}
interface AvatarIconsProps extends React.HTMLAttributes<HTMLDivElement> {
extraCount?: number;
avatars: Avatar[];
className?: string;
}
export default function AvatarIcons({
extraCount,
avatars,
className,
...props
}: AvatarIconsProps) {
return (
<div className={cn("-space-x-4 justy-start flex select-none", className)} {...props}>
{avatars.map((image, i) => (
<div
className={cn(
"w-12 h-12 border-4 overflow-hidden border-white dark:border-black shrink-0 rounded-full group relative",
className
)}
key={i}
>
<img
src={image.src}
alt={image.alt}
width={50}
height={50}
className="w-full h-full object-cover transition-transform duration-200 group-hover:scale-[115%] group-hover:-rotate-12"
/>
</div>
))}
{extraCount && (
<div className="w-12 h-12 border-4 border-white dark:border-black shrink-0 rounded-full bg-neutral-100 dark:bg-neutral-900 flex items-center justify-center z-20">
<span className="text-sm font-medium text-black dark:text-white">+{extraCount}</span>
</div>
)}
</div>
);
}