{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ecommerce-16",
  "type": "registry:block",
  "description": "Subscribe-and-save product page with purchase type radios, delivery frequency, grind and bag count options.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/ecommerce/ecommerce-16.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  CalendarClock,\n  Check,\n  CirclePause as PauseCircle,\n  Star,\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\"\nimport { IPhone } from \"@/registry/designali/ui/apple/iphone\"\nimport { DotPattern } from \"@/registry/designali/ui/dot-pattern\"\n\nconst PRICE = 22\n\nconst plans = [\n  { id: \"once\", label: \"One-time purchase\", discount: 0, note: \"\" },\n  { id: \"sub\", label: \"Subscribe & save\", discount: 0.15, note: \"Save 15% on every renewal\" },\n]\n\nconst frequencies = [\"Monthly\", \"Quarterly\", \"Yearly\"]\nconst grinds = [\"Next.js\", \"React\", \"Figma\", \"HTML\"]\n\nexport default function Ecommerce16() {\n  const [plan, setPlan] = useState(\"sub\")\n  const [frequency, setFrequency] = useState(frequencies[1]!)\n  const [grind, setGrind] = useState(grinds[0]!)\n  const [bags, setBags] = useState(2)\n\n  const discount = plans.find((p) => p.id === plan)?.discount ?? 0\n  const unit = PRICE * (1 - discount)\n  const total = unit * bags\n\n  return (\n    <section className=\"w-full bg-background py-16 text-foreground md:py-24\">\n      <div className=\"mx-auto grid max-w-6xl gap-10 px-6 md:grid-cols-2 md:gap-14\">\n        <div className=\"relative flex aspect-square items-center justify-center overflow-hidden border border-border bg-gradient-to-br from-primary/10 to-primary/20 dark:from-chart-5 dark:to-chart-5\">\n          <DotPattern className=\"text-primary/60 [mask-image:radial-gradient(circle,white,transparent_70%)]\" />\n          <div className=\"relative flex h-3/4 items-end\">\n            <IPad variant=\"ipad-pro\" color=\"silver\" size=\"sm\" className=\"h-full! max-w-full drop-shadow-2xl\">\n              <img src=\"/images/templates/aliimam-comp.jpg\" alt=\"Designali Pro blocks library\" className=\"size-full object-cover object-top\" />\n            </IPad>\n            <IPhone size=\"sm\" color=\"silver\" className=\"-ml-12 h-1/2! max-w-full drop-shadow-2xl\">\n              <img src=\"/img/chat-1-light.jpg\" alt=\"\" className=\"size-full object-cover object-top\" />\n            </IPhone>\n          </div>\n          <span className=\"absolute top-4 left-4 bg-background px-2 py-1 text-xs\">Updated Monday</span>\n        </div>\n\n        <div>\n          <p className=\"text-xs tracking-widest text-muted-foreground uppercase\">Membership · Designali</p>\n          <h2 className=\"mt-2 text-3xl font-medium tracking-tight md:text-4xl\">Designali Pro</h2>\n          <p className=\"mt-2 flex items-center gap-1.5 text-sm text-muted-foreground\">\n            <Star className=\"size-4 fill-primary text-primary\" />\n            4.9 · 1,840 reviews · 460+ blocks, 4,000+ icons, every template\n          </p>\n\n          <fieldset className=\"mt-8 space-y-2\">\n            <legend className=\"sr-only\">Purchase type</legend>\n            {plans.map((p) => {\n              const selected = plan === p.id\n              return (\n                <label\n                  key={p.id}\n                  className={cn(\n                    \"block cursor-pointer border p-4 transition-colors\",\n                    selected ? \"border-foreground\" : \"border-border hover:bg-muted/40\"\n                  )}\n                >\n                  <span className=\"flex items-center gap-3\">\n                    <input\n                      type=\"radio\"\n                      name=\"e16-plan\"\n                      checked={selected}\n                      onChange={() => setPlan(p.id)}\n                      className=\"size-4 accent-foreground\"\n                    />\n                    <span className=\"flex-1 text-sm font-medium\">{p.label}</span>\n                    <span className=\"text-sm tabular-nums\">\n                      {p.discount > 0 && (\n                        <span className=\"mr-2 text-muted-foreground line-through\">${PRICE}</span>\n                      )}\n                      ${(PRICE * (1 - p.discount)).toFixed(2)}\n                    </span>\n                  </span>\n                  {p.note && (\n                    <span className=\"mt-1 block pl-7 text-xs text-chart-3 dark:text-primary\">{p.note}</span>\n                  )}\n                  {p.id === \"sub\" && selected && (\n                    <span className=\"mt-4 block space-y-3 pl-7\">\n                      <span className=\"flex flex-wrap gap-2\">\n                        {frequencies.map((f) => (\n                          <button\n                            key={f}\n                            type=\"button\"\n                            onClick={(e) => {\n                              e.preventDefault()\n                              setFrequency(f)\n                            }}\n                            className={cn(\n                              \"border px-3 py-1.5 text-xs transition-colors\",\n                              frequency === f ? \"border-foreground bg-muted\" : \"border-border hover:bg-muted\"\n                            )}\n                          >\n                            {f}\n                          </button>\n                        ))}\n                      </span>\n                      <span className=\"flex flex-col gap-1.5 text-xs text-muted-foreground\">\n                        <span className=\"flex items-center gap-2\"><Check className=\"size-3.5\" /> New blocks every week</span>\n                        <span className=\"flex items-center gap-2\"><PauseCircle className=\"size-3.5\" /> Pause, skip or cancel any time</span>\n                      </span>\n                    </span>\n                  )}\n                </label>\n              )\n            })}\n          </fieldset>\n\n          <div className=\"mt-6 grid gap-6 sm:grid-cols-[1fr_auto]\">\n            <div>\n              <p className=\"text-sm font-medium\">Stack</p>\n              <div className=\"mt-2 grid grid-cols-2 gap-2 sm:grid-cols-4\">\n                {grinds.map((g) => (\n                  <button\n                    key={g}\n                    type=\"button\"\n                    onClick={() => setGrind(g)}\n                    className={cn(\n                      \"border px-2 py-2 text-xs transition-colors\",\n                      grind === g ? \"border-foreground bg-foreground text-background\" : \"border-border hover:bg-muted\"\n                    )}\n                  >\n                    {g}\n                  </button>\n                ))}\n              </div>\n            </div>\n            <div>\n              <p className=\"text-sm font-medium\">Seats</p>\n              <div className=\"mt-2 flex\">\n                {[1, 2, 3].map((n) => (\n                  <button\n                    key={n}\n                    type=\"button\"\n                    onClick={() => setBags(n)}\n                    className={cn(\n                      \"-ml-px size-9 border text-sm first:ml-0\",\n                      bags === n ? \"relative border-foreground bg-foreground text-background\" : \"border-border hover:bg-muted\"\n                    )}\n                  >\n                    {n}\n                  </button>\n                ))}\n              </div>\n            </div>\n          </div>\n\n          <Button size=\"lg\" className=\"mt-8 w-full\">\n            {plan === \"sub\" ? \"Start subscription\" : \"Add to cart\"} · ${total.toFixed(2)}\n          </Button>\n          {plan === \"sub\" && (\n            <p className=\"mt-3 flex items-center justify-center gap-2 text-xs text-muted-foreground\">\n              <CalendarClock className=\"size-3.5\" />\n              {bags} x {grind.toLowerCase()}, {frequency.toLowerCase()}. First delivery Thursday.\n            </p>\n          )}\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "850px"
  },
  "categories": [
    "ecommerce"
  ]
}