Spaces:
Running
Running
File size: 1,514 Bytes
576d07a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import { COCO_EXAMPLES } from "../utils/coco-examples";
interface ExampleGalleryProps {
onSelect: (url: string, prompt: string) => void;
disabled?: boolean;
}
export function ExampleGallery({ onSelect, disabled }: ExampleGalleryProps) {
return (
<div className={disabled ? "opacity-50 pointer-events-none" : ""}>
<p className="text-sm font-medium text-white/60 mb-3">
Or try an example:
</p>
<div className="grid grid-cols-3 sm:grid-cols-6 gap-3">
{COCO_EXAMPLES.map((example) => (
<button
key={example.label}
onClick={() => onSelect(example.url, example.prompt)}
className="group relative overflow-hidden rounded-xl border border-white/10 bg-white/5 transition-all hover:border-[#1a73e8]/60 hover:shadow-lg hover:shadow-[#1a73e8]/20 cursor-pointer"
>
<div className="aspect-square overflow-hidden">
<img
src={example.url}
alt={example.label}
className="w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"
loading="lazy"
/>
</div>
<div className="absolute inset-0 bg-gradient-to-t from-black/70 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-2">
<span className="text-xs font-medium text-white">{example.label}</span>
</div>
</button>
))}
</div>
</div>
);
}
|