{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ecommerce-06",
  "type": "registry:block",
  "description": "Product listing with sidebar filters for category, material and price, active filter chips and sorting.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/ecommerce/ecommerce-06.tsx",
      "content": "\"use client\"\n\nimport { useMemo, useState } from \"react\"\nimport {\n  SlidersHorizontal,\n  X,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { cn } from \"@workspace/ui/lib/utils\"\nimport { IPad } from \"@/registry/designali/ui/apple/ipad\"\n\ntype Product = {\n  name: string\n  category: string\n  price: number\n  material: string\n  image: string\n}\n\nconst products: Product[] = [\n  { name: \"Design Agency Template\", category: \"Templates\", price: 79, material: \"Next.js\", image: \"/images/templates/design-agency.jpg\" },\n  { name: \"Hero Blocks Pack\", category: \"Blocks\", price: 39, material: \"React\", image: \"/images/templates/aliimam-comp.jpg\" },\n  { name: \"Portfolio Simple Template\", category: \"Templates\", price: 49, material: \"Figma\", image: \"/images/templates/portfolio-simple.jpg\" },\n  { name: \"Designali Icons Pro\", category: \"Icons\", price: 39, material: \"SVG\", image: \"/images/templates/dalim-icons-old.jpg\" },\n  { name: \"Blocks Pro Bundle\", category: \"Blocks\", price: 149, material: \"Next.js\", image: \"/images/templates/dalim-ui-old.jpg\" },\n  { name: \"Designali Logos Pack\", category: \"Icons\", price: 29, material: \"React\", image: \"/images/templates/dalim-graphic-old.jpg\" },\n  { name: \"Resort Template\", category: \"Templates\", price: 69, material: \"Tailwind CSS\", image: \"/images/templates/resort.jpg\" },\n  { name: \"Vectors Starter Pack\", category: \"Icons\", price: 19, material: \"Figma\", image: \"/images/templates/dalim-visuals-old.jpg\" },\n  { name: \"Pricing & FAQ Blocks\", category: \"Blocks\", price: 35, material: \"Tailwind CSS\", image: \"/images/templates/vercel.jpg\" },\n]\n\nconst categories = [\"Templates\", \"Blocks\", \"Icons\"]\nconst materials = [\"Next.js\", \"React\", \"Tailwind CSS\", \"Figma\", \"SVG\"]\nconst sorts = [\n  { id: \"featured\", label: \"Featured\" },\n  { id: \"low\", label: \"Price: low to high\" },\n  { id: \"high\", label: \"Price: high to low\" },\n]\n\nfunction toggle(list: string[], value: string) {\n  return list.includes(value) ? list.filter((v) => v !== value) : [...list, value]\n}\n\nexport default function Ecommerce06() {\n  const [cats, setCats] = useState<string[]>([])\n  const [mats, setMats] = useState<string[]>([])\n  const [maxPrice, setMaxPrice] = useState(150)\n  const [sort, setSort] = useState(\"featured\")\n  const [showFilters, setShowFilters] = useState(false)\n\n  const visible = useMemo(() => {\n    const list = products.filter(\n      (p) =>\n        (cats.length === 0 || cats.includes(p.category)) &&\n        (mats.length === 0 || mats.includes(p.material)) &&\n        p.price <= maxPrice\n    )\n    if (sort === \"low\") return [...list].sort((a, b) => a.price - b.price)\n    if (sort === \"high\") return [...list].sort((a, b) => b.price - a.price)\n    return list\n  }, [cats, mats, maxPrice, sort])\n\n  const active = [...cats, ...mats]\n  const clear = () => {\n    setCats([])\n    setMats([])\n    setMaxPrice(150)\n  }\n\n  return (\n    <section className=\"w-full bg-background py-16 text-foreground md:py-24\">\n      <div className=\"mx-auto max-w-6xl px-6\">\n        <div className=\"flex flex-col justify-between gap-4 border-b border-border pb-6 sm:flex-row sm:items-end\">\n          <div>\n            <h2 className=\"text-3xl font-medium tracking-tight\">Designali store</h2>\n            <p className=\"mt-1 text-sm text-muted-foreground\">{visible.length} products</p>\n          </div>\n          <div className=\"flex items-center gap-2\">\n            <Button variant=\"outline\" className=\"lg:hidden\" onClick={() => setShowFilters((s) => !s)}>\n              <SlidersHorizontal />\n              Filters\n            </Button>\n            <select\n              value={sort}\n              onChange={(e) => setSort(e.target.value)}\n              aria-label=\"Sort products\"\n              className=\"h-10 border border-border bg-background px-3 text-sm\"\n            >\n              {sorts.map((s) => (\n                <option key={s.id} value={s.id}>\n                  {s.label}\n                </option>\n              ))}\n            </select>\n          </div>\n        </div>\n\n        <div className=\"mt-8 grid gap-10 lg:grid-cols-[220px_1fr]\">\n          <aside className={cn(\"space-y-8 text-sm\", showFilters ? \"block\" : \"hidden lg:block\")}>\n            <fieldset>\n              <legend className=\"font-medium\">Category</legend>\n              <div className=\"mt-3 space-y-2\">\n                {categories.map((c) => (\n                  <label key={c} className=\"flex cursor-pointer items-center gap-3\">\n                    <input\n                      type=\"checkbox\"\n                      checked={cats.includes(c)}\n                      onChange={() => setCats((l) => toggle(l, c))}\n                      className=\"size-4 accent-foreground\"\n                    />\n                    {c}\n                    <span className=\"ml-auto text-xs text-muted-foreground\">\n                      {products.filter((p) => p.category === c).length}\n                    </span>\n                  </label>\n                ))}\n              </div>\n            </fieldset>\n            <fieldset>\n              <legend className=\"font-medium\">Stack</legend>\n              <div className=\"mt-3 flex flex-wrap gap-2\">\n                {materials.map((m) => (\n                  <button\n                    key={m}\n                    type=\"button\"\n                    onClick={() => setMats((l) => toggle(l, m))}\n                    aria-pressed={mats.includes(m)}\n                    className={cn(\n                      \"border px-3 py-1.5 text-xs transition-colors\",\n                      mats.includes(m) ? \"border-foreground bg-foreground text-background\" : \"border-border hover:bg-muted\"\n                    )}\n                  >\n                    {m}\n                  </button>\n                ))}\n              </div>\n            </fieldset>\n            <fieldset>\n              <legend className=\"flex w-full justify-between font-medium\">\n                Max price <span className=\"font-normal text-muted-foreground tabular-nums\">${maxPrice}</span>\n              </legend>\n              <input\n                type=\"range\"\n                min={20}\n                max={150}\n                step={5}\n                value={maxPrice}\n                onChange={(e) => setMaxPrice(Number(e.target.value))}\n                aria-label=\"Maximum price\"\n                className=\"mt-4 w-full accent-foreground\"\n              />\n            </fieldset>\n          </aside>\n\n          <div>\n            {active.length > 0 && (\n              <div className=\"mb-6 flex flex-wrap items-center gap-2\">\n                {active.map((f) => (\n                  <button\n                    key={f}\n                    type=\"button\"\n                    onClick={() => {\n                      setCats((l) => l.filter((v) => v !== f))\n                      setMats((l) => l.filter((v) => v !== f))\n                    }}\n                    className=\"flex items-center gap-1 bg-muted px-2 py-1 text-xs\"\n                  >\n                    {f}\n                    <X className=\"size-3\" />\n                  </button>\n                ))}\n                <button type=\"button\" onClick={clear} className=\"text-xs underline underline-offset-4\">\n                  Clear all\n                </button>\n              </div>\n            )}\n\n            {visible.length === 0 ? (\n              <div className=\"border border-dashed border-border py-20 text-center text-sm text-muted-foreground\">\n                Nothing matches those filters.{\" \"}\n                <button type=\"button\" onClick={clear} className=\"text-foreground underline underline-offset-4\">\n                  Reset\n                </button>\n              </div>\n            ) : (\n              <div className=\"grid grid-cols-2 gap-x-4 gap-y-8 md:grid-cols-3\">\n                {visible.map((p) => (\n                  <a key={p.name} href=\"#\" className=\"group block\">\n                    <div className=\"relative flex aspect-square items-center justify-center overflow-hidden border border-border bg-gradient-to-br from-primary/15 to-muted p-3\">\n                      <IPad variant=\"ipad-pro\" color=\"silver\" orientation=\"landscape\" size=\"sm\" className=\"h-auto! w-full! max-w-full transition-transform duration-500 group-hover:scale-105\">\n                        <img src={p.image} alt={p.name} className=\"size-full object-cover object-top\" />\n                      </IPad>\n                    </div>\n                    <p className=\"mt-3 text-sm font-medium\">{p.name}</p>\n                    <p className=\"mt-0.5 flex justify-between text-xs text-muted-foreground\">\n                      <span>{p.material}</span>\n                      <span className=\"text-foreground tabular-nums\">${p.price}</span>\n                    </p>\n                  </a>\n                ))}\n              </div>\n            )}\n          </div>\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "1000px"
  },
  "categories": [
    "ecommerce"
  ]
}