{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ecommerce-07",
  "type": "registry:block",
  "description": "Recommended products scroll-snap carousel with SVG sneakers, colour swatches, sale badges and wishlist toggles.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/ecommerce/ecommerce-07.tsx",
      "content": "\"use client\"\n\nimport { useRef, useState } from \"react\"\nimport {\n  ChevronLeft,\n  ChevronRight,\n  Heart,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { cn } from \"@workspace/ui/lib/utils\"\nimport { Macbook } from \"@/registry/designali/ui/apple/macbook\"\n\nconst products = [\n  { name: \"Design Agency Template\", brand: \"Designali\", price: 79, was: 0, swatches: [\"var(--primary)\", \"black\"], image: \"/images/templates/design-agency.jpg\" },\n  { name: \"Portfolio Simple Template\", brand: \"Designali\", price: 39, was: 49, swatches: [\"white\", \"black\"], image: \"/images/templates/portfolio-simple.jpg\" },\n  { name: \"Resort Template\", brand: \"Designali\", price: 69, was: 0, swatches: [\"var(--primary)\", \"var(--chart-3)\"], image: \"/images/templates/resort.jpg\" },\n  { name: \"AI Startup Template\", brand: \"Designali\", price: 79, was: 0, swatches: [\"black\", \"var(--chart-1)\"], image: \"/images/templates/ai.jpg\" },\n  { name: \"Dalim UI Kit\", brand: \"Dalim\", price: 29, was: 39, swatches: [\"var(--chart-5)\", \"white\"], image: \"/images/templates/dalim-ui-old.jpg\" },\n  { name: \"Vercel Starter Template\", brand: \"Designali\", price: 59, was: 0, swatches: [\"var(--primary)\", \"white\"], image: \"/images/templates/vercel.jpg\" },\n]\n\nfunction Preview({ color, image, name }: { color: string; image: string; name: string }) {\n  return (\n    <div\n      className=\"flex size-full items-center justify-center p-4\"\n      style={{ background: `radial-gradient(circle at 50% 60%, ${color}, transparent 75%)` }}\n    >\n      <Macbook variant=\"macbook-air\" color=\"silver\" size=\"sm\" className=\"w-full! max-w-full\">\n        <img src={image} alt={name} className=\"size-full object-cover object-top\" />\n      </Macbook>\n    </div>\n  )\n}\n\nexport default function Ecommerce07() {\n  const track = useRef<HTMLDivElement>(null)\n  const [picked, setPicked] = useState<Record<string, number>>({})\n  const [saved, setSaved] = useState<string[]>([])\n\n  const scroll = (dir: 1 | -1) =>\n    track.current?.scrollBy({ left: dir * track.current.clientWidth * 0.75, behavior: \"smooth\" })\n\n  return (\n    <section className=\"w-full overflow-hidden bg-background py-16 text-foreground md:py-24\">\n      <div className=\"mx-auto max-w-6xl px-6\">\n        <div className=\"flex items-end justify-between gap-4\">\n          <div>\n            <h2 className=\"text-2xl font-medium tracking-tight md:text-3xl\">You might also like</h2>\n            <p className=\"mt-1 text-sm text-muted-foreground\">Based on the Design Agency Template you viewed</p>\n          </div>\n          <div className=\"flex gap-2\">\n            <Button variant=\"outline\" size=\"icon-lg\" aria-label=\"Scroll left\" onClick={() => scroll(-1)}>\n              <ChevronLeft />\n            </Button>\n            <Button variant=\"outline\" size=\"icon-lg\" aria-label=\"Scroll right\" onClick={() => scroll(1)}>\n              <ChevronRight />\n            </Button>\n          </div>\n        </div>\n\n        <div\n          ref={track}\n          className=\"-mx-6 mt-8 flex snap-x snap-mandatory scroll-px-6 gap-4 overflow-x-auto px-6 pb-2 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\"\n        >\n          {products.map((p) => {\n            const swatch = picked[p.name] ?? 0\n            const isSaved = saved.includes(p.name)\n            return (\n              <div key={p.name} className=\"w-[70%] shrink-0 snap-start sm:w-[42%] md:w-[30%] lg:w-[23%]\">\n                <div className=\"relative flex aspect-square items-center justify-center overflow-hidden border border-border bg-muted\">\n                  <Preview color={p.swatches[swatch] ?? \"var(--muted)\"} image={p.image} name={p.name} />\n                  {p.was > 0 && (\n                    <span className=\"absolute top-3 left-3 bg-destructive px-2 py-0.5 text-[10px] font-medium text-white\">\n                      -{Math.round((1 - p.price / p.was) * 100)}%\n                    </span>\n                  )}\n                  <button\n                    type=\"button\"\n                    aria-label={isSaved ? `Remove ${p.name} from wishlist` : `Save ${p.name}`}\n                    aria-pressed={isSaved}\n                    onClick={() =>\n                      setSaved((s) => (s.includes(p.name) ? s.filter((n) => n !== p.name) : [...s, p.name]))\n                    }\n                    className=\"absolute top-3 right-3 flex size-8 items-center justify-center bg-background\"\n                  >\n                    <Heart className={cn(\"size-4\", isSaved && \"fill-destructive text-destructive\")} />\n                  </button>\n                </div>\n                <div className=\"mt-3 flex gap-1.5\">\n                  {p.swatches.map((c, i) => (\n                    <button\n                      key={c}\n                      type=\"button\"\n                      aria-label={`Colour ${i + 1}`}\n                      onClick={() => setPicked((s) => ({ ...s, [p.name]: i }))}\n                      className={cn(\n                        \"size-4 rounded-full border border-border ring-offset-2 ring-offset-background\",\n                        swatch === i && \"ring-1 ring-foreground\"\n                      )}\n                      style={{ background: c }}\n                    />\n                  ))}\n                </div>\n                <p className=\"mt-3 text-xs text-muted-foreground\">{p.brand}</p>\n                <a href=\"#\" className=\"mt-0.5 block text-sm font-medium hover:underline\">\n                  {p.name}\n                </a>\n                <p className=\"mt-1 flex gap-2 text-sm tabular-nums\">\n                  <span className={cn(p.was > 0 && \"text-destructive dark:text-destructive\")}>${p.price}</span>\n                  {p.was > 0 && <span className=\"text-muted-foreground line-through\">${p.was}</span>}\n                </p>\n              </div>\n            )\n          })}\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "650px"
  },
  "categories": [
    "ecommerce"
  ]
}