Product Listing Shell
The page shell for a product listing: banner, heading row, toolbar, sidebar beside the grid on desktop, and pagination below.
npx shadcn@latest add https://ui.develop-better-solutions.com/r/product-listing-shell.jsonAll products
6 products
Sort
Usage
product-listing-shell-example.tsx
"use client";
import { useState } from "react";
import { CategoryChipNav, FilterSidebar, ProductGrid, ProductListingShell, SlidingPagination, StoreProductCard } from "@dbs/ui";
const ITEMS = [
["Walnut side table", "1,290 MAD", "steps-boxes"],
["Linen throw", "420 MAD", "approach-glass"],
["Ceramic vase", "290 MAD", "approach-glass"],
["Oak shelf", "980 MAD", "steps-boxes"],
["Wool rug", "1,850 MAD", "approach-glass"],
["Brass lamp", "760 MAD", "approach-glass"],
] as const;
export default function ProductListingShellExample() {
const [cat, setCat] = useState("all");
const [page, setPage] = useState(1);
const [range, setRange] = useState<[number, number]>([200, 1800]);
const [sort, setSort] = useState("featured");
return (
<ProductListingShell
title="All products"
resultLabel="6 products"
toolbar={
<CategoryChipNav
active={cat}
onSelect={setCat}
categories={[{ id: "all", label: "All" }, { id: "living", label: "Living" }, { id: "decor", label: "Decor" }]}
sort={{ value: sort, onChange: setSort, options: [{ value: "featured", label: "Featured" }, { value: "price", label: "Price" }] }}
/>
}
sidebar={
<FilterSidebar
groups={[
{ id: "price", type: "range", title: "Price range", min: 0, max: 2000, step: 50, value: range, onChange: setRange, format: (n) => `${n} MAD` },
]}
/>
}
pagination={<SlidingPagination page={page} pageCount={3} onPageChange={setPage} />}
>
<ProductGrid columns={3}>
{ITEMS.map(([name, price, img]) => (
<StoreProductCard key={name} name={name} price={price} image={`/samples/${img}.jpg`} />
))}
</ProductGrid>
</ProductListingShell>
);
}