// "use client"

import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Gallery } from "@/generated/prisma";
import Link from "next/link";

export default function ListGalleries({ galleries }: { galleries: Gallery[] }) {
  return (
    <div className="grid gap-6 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4">
      {galleries.map((gallery) => (
        <Link href={`/galleries/edit/${gallery.id}`} key={gallery.id}>
          <Card className="overflow-hidden">
            <CardHeader>
              <CardTitle className="text-base truncate">{gallery.name}</CardTitle>
            </CardHeader>
            <CardContent>
              {gallery.description && <p className="text-sm text-muted-foreground">{gallery.description}</p>}
            </CardContent>
          </Card>
        </Link>
      ))}
    </div>
  );
}