39 lines
989 B
TypeScript
39 lines
989 B
TypeScript
"use client";
|
|
|
|
/**
|
|
* CollectionViews — grid-only renderer for collection lists.
|
|
*
|
|
* `hrefFor(c)` chooses where each card links: the owner page sends users
|
|
* to /u/me/collections/<id>; the public profile sends them to /c/<id>.
|
|
* The carousel "scroll view" is reached by clicking through to the
|
|
* collection detail page.
|
|
*/
|
|
|
|
import type { Collection } from "@/lib/social";
|
|
import { CollectionGridCard } from "./collection-grid-card";
|
|
|
|
export function CollectionViews({
|
|
collections,
|
|
hrefFor,
|
|
emptyMessage,
|
|
}: {
|
|
collections: Collection[];
|
|
hrefFor: (c: Collection) => string;
|
|
emptyMessage?: string;
|
|
}) {
|
|
if (collections.length === 0) {
|
|
return (
|
|
<p className="text-sm text-muted-foreground">
|
|
{emptyMessage ?? "No collections yet."}
|
|
</p>
|
|
);
|
|
}
|
|
return (
|
|
<div className="grid grid-cols-2 gap-3 sm:gap-4">
|
|
{collections.map((c) => (
|
|
<CollectionGridCard key={c.id} collection={c} href={hrefFor(c)} />
|
|
))}
|
|
</div>
|
|
);
|
|
}
|