import {type ReactNode} from 'react'; import {Link, useLocation} from 'react-router'; const FILTER_TABS: {id: string; label: string; to: string}[] = [ {id: 'all', label: 'All Products', to: '/collections/all'}, {id: 'face', label: 'Face', to: '/collections/face'}, {id: 'ritual', label: 'Ritual', to: '/collections/ritual'}, ]; type CollectionPageViewProps = { title: string; /** Optional `className` for the H1 (default matches PLP: `max-w-[20ch]`). Use a wider class for long search queries. */ titleClassName?: string; eyebrow?: string; /** Subtitle e.g. "8 products" — omit on paginated subpages if unknown */ productCountLine?: string | null; /** When false, hides the All / Face / Ritual collection tabs (e.g. search page). */ showFilterTabs?: boolean; children: ReactNode; }; function buildFilterTo(path: string, search: string) { const sp = new URLSearchParams(search); sp.delete('cursor'); sp.delete('direction'); const q = sp.toString(); return q ? `${path}?${q}` : path; } function isFilterActive(pathname: string, itemTo: string): boolean { const path = (pathname.replace(/\/$/, '') || '/') as string; const to = itemTo.replace(/\/$/, ''); if (to === '/collections/all') { return path === '/collections/all' || path.endsWith('/collections/all'); } return path === to || path.endsWith(to); } /** * Figma: Products / collection (node 121:2974) — band header, filter tabs, sort, 4-up grid. */ export function CollectionPageView({ title, titleClassName = "max-w-[20ch]", eyebrow = 'Our Collection', productCountLine, showFilterTabs = true, children, }: CollectionPageViewProps) { const location = useLocation(); return (
{eyebrow}
{productCountLine}
) : null}