"use client";
import { SlidingPuzzleGallery } from "@/components/ui/sliding-puzzle-gallery";
import type { PuzzleItem } from "@/components/ui/sliding-puzzle-gallery";
const settings = {
size: 4,
autoplay: true,
hold: 2400,
moveDuration: 150,
shuffleMoves: 16,
playable: true,
numbers: false,
gap: 4,
};
const PHOTOS = [
{ id: "photo-1579264688258-c0ebf8c7942a", title: "Eurasian eagle-owl", caption: "Ear tufts up, orange eyes locked on the lens." },
{ id: "photo-1639104738898-ec92e9e40a0a", title: "Red fox", caption: "Caught mid-step at the edge of the woods." },
{ id: "photo-1619475762212-da12e5e15f18", title: "Tiger in the snow", caption: "Frost on the whiskers and a steady stare." },
{ id: "photo-1542880941-1abfea46bba6", title: "Red panda", caption: "Round ears, white brows and plenty of curiosity." },
{ id: "photo-1544923408-75c5cef46f14", title: "Scarlet macaw", caption: "Red, yellow and blue, all on one bird." },
{ id: "photo-1745933115134-9cd90e3efcc7", title: "Lion", caption: "A heavy golden mane and a calm, slow look." },
];
const ITEMS: PuzzleItem[] = PHOTOS.map(({ id, title, caption }) => ({
src: `https://images.unsplash.com/${id}?w=1000&h=1000&fit=crop&q=80&auto=format`,
alt: title,
title,
caption,
}));
const CCGATHER_URL = "https://ccgather.com/?utm_source=21st&utm_medium=component&utm_campaign=sliding_puzzle_gallery";
export default function Demo(props: Partial<typeof settings>) {
const s = { ...settings, ...props };
return (
<div className="flex min-h-screen w-full flex-col items-center justify-center gap-5 bg-background p-6 text-foreground">
<SlidingPuzzleGallery
items={ITEMS}
size={s.size}
autoplay={s.autoplay}
hold={s.hold}
moveDuration={s.moveDuration}
shuffleMoves={s.shuffleMoves}
playable={s.playable}
numbers={s.numbers}
gap={s.gap}
className="max-w-3xl"
/>
<p className="text-xs text-muted-foreground">
Wildlife portraits that solve themselves. Click a tile to take over.{" "}
<a href={CCGATHER_URL} target="_blank" rel="noreferrer" className="underline underline-offset-4 transition-colors hover:text-foreground">
By the CCgather team
</a>
</p>
</div>
);
}