{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "counter-curtain-launch-demo",
  "type": "registry:block",
  "title": "Counter Curtain: Launch Page",
  "description": "Page Preloader example, Launch Page: A custom counter in the drop's colors, with a padded number and a progress bar, on a curtain that falls away. `onComplete` starts the countdown as it goes, so the clock is already ticking when it's uncovered. A take on the preloader (loading screen). Fits preloader, hero and portfolio sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "preloader",
    "hero",
    "portfolio",
    "number-counter",
    "text"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/counter-curtain#counter-curtain-launch-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/counter-curtain.json"
  ],
  "files": [
    {
      "path": "components/counter-curtain-launch-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport {\n  CounterCurtain,\n  CounterCurtainLine,\n  CounterCurtainValue,\n} from \"@/components/ui/counter-curtain\";\n\nconst photo =\n  \"https://images.unsplash.com/photo-1606107557195-0e29a4b5b4aa?auto=format&fit=crop&w=1000&h=1000&q=80\";\n\nconst DROP = 2 * 86400 + 14 * 3600 + 9 * 60 + 31; // seconds left when the page opens\n\n// A custom counter: the drop's own type, a padded number and a progress bar\n// driven by --counter-progress. onComplete starts the clock as the curtain\n// lifts, so it's already ticking when it's uncovered.\nexport function CounterCurtainLaunchDemo() {\n  const [run, setRun] = React.useState(0);\n  const [live, setLive] = React.useState(false);\n\n  const replay = () => {\n    setLive(false);\n    setRun((r) => r + 1);\n  };\n\n  return (\n    <div className=\"flex h-[var(--demo-height,36rem)] w-full flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white text-zinc-950 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50\">\n      <BrowserBar url=\"volt.run/drop-04\" run={run} onReload={replay} />\n      <CounterCurtain\n        key={run}\n        contained\n        once={false}\n        direction=\"down\"\n        onComplete={() => setLive(true)}\n        curtainClassName=\"bg-lime-300 text-lime-950 dark:bg-lime-300\"\n        counter={\n          <div className=\"flex h-full flex-col justify-between p-5 sm:p-8\">\n            <div className=\"flex justify-between text-[11px] font-semibold tracking-[0.2em] uppercase\">\n              <span>Volt Trainer</span>\n              <span>Drop 04</span>\n            </div>\n            <CounterCurtainValue\n              pad={3}\n              className=\"text-center text-[clamp(5rem,30cqw,17rem)] leading-none font-black tracking-[-0.07em]\"\n            />\n            <div className=\"h-1.5 overflow-hidden rounded-full bg-lime-950/10\">\n              <div className=\"h-full origin-left scale-x-[var(--counter-progress,0)] rounded-full bg-lime-950\" />\n            </div>\n          </div>\n        }\n        className=\"@container min-h-0 flex-1\"\n      >\n        <div className=\"flex h-full flex-col px-5 pt-4 pb-5 sm:px-8 sm:pt-5 sm:pb-7\">\n          <header className=\"flex items-center justify-between text-sm\">\n            <CounterCurtainLine className=\"font-black tracking-tight\">VOLT</CounterCurtainLine>\n            <CounterCurtainLine className=\"text-zinc-500\">Drop 04 · 500 pairs</CounterCurtainLine>\n          </header>\n\n          <div className=\"flex min-h-0 flex-1 items-center gap-6 @2xl:gap-10\">\n            <div className=\"min-w-0 flex-1\">\n              <h1 className=\"text-[clamp(3.25rem,13cqw,9rem)] leading-[0.86] font-black tracking-[-0.06em] uppercase\">\n                <CounterCurtainLine>Volt</CounterCurtainLine>{\" \"}\n                <CounterCurtainLine>Trainer</CounterCurtainLine>\n              </h1>\n              <CounterCurtainLine className=\"mt-5 max-w-sm text-sm leading-relaxed text-pretty text-zinc-600 sm:mt-6 dark:text-zinc-400\">\n                A flat, grippy sole and a heel that locks in for lifts. In lime, for one\n                weekend only.\n              </CounterCurtainLine>\n              <div className=\"mt-6 flex flex-wrap items-center gap-x-6 gap-y-4 sm:mt-8\">\n                <CounterCurtainLine>\n                  <Countdown live={live} />\n                </CounterCurtainLine>\n                <CounterCurtainLine>\n                  <button\n                    type=\"button\"\n                    className=\"h-10 rounded-full bg-lime-300 px-5 text-sm font-semibold text-lime-950 transition-[background-color,scale] duration-150 hover:bg-lime-200 active:scale-[0.97]\"\n                  >\n                    Notify me\n                  </button>\n                </CounterCurtainLine>\n              </div>\n            </div>\n            <CounterCurtainLine className=\"hidden w-[38%] shrink-0 rounded-2xl @xl:block\">\n              <img\n                src={photo}\n                alt=\"A lime and black trainer\"\n                className=\"aspect-square w-full rounded-2xl object-cover\"\n              />\n            </CounterCurtainLine>\n          </div>\n        </div>\n      </CounterCurtain>\n    </div>\n  );\n}\n\nfunction Countdown({ live }: { live: boolean }) {\n  const [left, setLeft] = React.useState(DROP);\n\n  React.useEffect(() => {\n    if (!live) return;\n    const timer = window.setInterval(() => setLeft((s) => Math.max(0, s - 1)), 1000);\n    return () => window.clearInterval(timer);\n  }, [live]);\n\n  const parts = [\n    [Math.floor(left / 86400), \"d\"],\n    [Math.floor((left % 86400) / 3600), \"h\"],\n    [Math.floor((left % 3600) / 60), \"m\"],\n    [left % 60, \"s\"],\n  ] as const;\n\n  return (\n    <p className=\"flex items-center gap-3 text-sm\">\n      <span className=\"relative flex size-2\">\n        {live ? <span className=\"absolute inset-0 animate-ping rounded-full bg-lime-400\" /> : null}\n        <span className=\"relative size-2 rounded-full bg-lime-500\" />\n      </span>\n      <span className=\"text-zinc-500\">Drops in</span>\n      <span className=\"font-semibold tabular-nums\">\n        {parts.map(([value, unit]) => (\n          <span key={unit} className=\"mr-1.5 last:mr-0\">\n            {String(value).padStart(2, \"0\")}\n            <span className=\"text-zinc-400\">{unit}</span>\n          </span>\n        ))}\n      </span>\n    </p>\n  );\n}\n\nfunction BrowserBar({ url, run, onReload }: { url: string; run: number; onReload: () => void }) {\n  return (\n    <div className=\"flex h-10 shrink-0 items-center gap-3 border-b border-zinc-200 bg-zinc-50 px-3 dark:border-zinc-800 dark:bg-zinc-900/60\">\n      <div aria-hidden className=\"flex gap-1.5\">\n        {[0, 1, 2].map((dot) => (\n          <span key={dot} className=\"size-2.5 rounded-full bg-zinc-300 dark:bg-zinc-700\" />\n        ))}\n      </div>\n      <button\n        type=\"button\"\n        onClick={onReload}\n        aria-label=\"Reload to play it again\"\n        title=\"Play again\"\n        className=\"grid size-7 place-items-center rounded-md text-zinc-500 transition-[background-color,color,scale] duration-150 hover:bg-zinc-200/70 hover:text-zinc-900 active:scale-[0.94] dark:hover:bg-zinc-800 dark:hover:text-zinc-100\"\n      >\n        <svg\n          viewBox=\"0 0 16 16\"\n          fill=\"none\"\n          stroke=\"currentColor\"\n          strokeWidth=\"1.5\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          className=\"size-3.5 transition-[rotate] duration-500 ease-[cubic-bezier(0.22,1,0.36,1)]\"\n          style={{ rotate: `${run * 360}deg` }}\n        >\n          <path d=\"M13.5 8a5.5 5.5 0 1 1-1.6-3.9\" />\n          <path d=\"M13.5 2.5v3h-3\" />\n        </svg>\n      </button>\n      <span className=\"mx-auto truncate rounded-md bg-zinc-100 px-3 py-1 font-mono text-[11px] text-zinc-500 dark:bg-zinc-800/80 dark:text-zinc-400\">\n        {url}\n      </span>\n      <span aria-hidden className=\"w-[4.75rem]\" />\n    </div>\n  );\n}\n"
    }
  ]
}