{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "golden-hour-studios-demo",
  "type": "registry:block",
  "title": "Golden Hour: Studio Clocks",
  "description": "Sunset Scene Background example, Studio Clocks: A design studio's contact card lit for the local time in each city. Switching from Lisbon to Tokyo carries the sun through the hours between. A take on the animated background (backdrop). Fits hero, CTA and features sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "hero",
    "cta",
    "features",
    "animated-background",
    "background",
    "svg"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/golden-hour#golden-hour-studios-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/golden-hour.json"
  ],
  "files": [
    {
      "path": "components/golden-hour-studios-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { GoldenHour } from \"@/components/ui/golden-hour\";\n\nconst STUDIOS = [\n  { city: \"Lisbon\", zone: \"Europe/Lisbon\", address: \"Rua das Flores 28\", team: \"6 in the studio\", open: [9, 19] },\n  { city: \"New York\", zone: \"America/New_York\", address: \"55 Water St, Brooklyn\", team: \"11 in the studio\", open: [9, 18] },\n  { city: \"Tokyo\", zone: \"Asia/Tokyo\", address: \"2-14 Kamimeguro, Meguro\", team: \"4 in the studio\", open: [10, 19] },\n] as const;\n\n// The time now, read on the client only: the page is prerendered, so a server\n// clock would be stale by the time anyone reads it.\nconst subscribe = (onChange: () => void) => {\n  const timer = window.setInterval(onChange, 30_000);\n  return () => window.clearInterval(timer);\n};\nconst readMinute = () => Math.floor(Date.now() / 60_000);\nconst noMinute = () => null;\n\nfunction hourIn(zone: string, minute: number) {\n  const parts = new Intl.DateTimeFormat(\"en-US\", { timeZone: zone, hour: \"numeric\", minute: \"numeric\", hourCycle: \"h23\" }).formatToParts(\n    new Date(minute * 60_000),\n  );\n  const get = (type: string) => Number(parts.find((part) => part.type === type)?.value ?? 0);\n  return get(\"hour\") + get(\"minute\") / 60;\n}\n\nfunction clock(hour: number) {\n  const minutes = Math.round(hour * 60) % (24 * 60);\n  const h = Math.floor(minutes / 60);\n  return `${((h + 11) % 12) + 1}:${String(minutes % 60).padStart(2, \"0\")} ${h < 12 ? \"AM\" : \"PM\"}`;\n}\n\nfunction hourLabel(hour: number) {\n  return `${((hour + 11) % 12) + 1} ${hour < 12 ? \"AM\" : \"PM\"}`;\n}\n\nexport function GoldenHourStudiosDemo() {\n  const minute = React.useSyncExternalStore(subscribe, readMinute, noMinute);\n  const [picked, setPicked] = React.useState(0);\n  const tabs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const studio = STUDIOS[picked];\n  const hour = minute === null ? null : hourIn(studio.zone, minute);\n  const isOpen = hour !== null && hour >= studio.open[0] && hour < studio.open[1];\n\n  const pick = (index: number) => {\n    const next = (index + STUDIOS.length) % STUDIOS.length;\n    setPicked(next);\n    tabs.current[next]?.focus();\n  };\n\n  return (\n    <div className=\"w-full max-w-3xl\">\n      <GoldenHour\n        id=\"golden-hour-studio\"\n        role=\"tabpanel\"\n        aria-labelledby={`golden-hour-studio-tab-${picked}`}\n        time={hour ?? \"golden\"}\n        className=\"flex aspect-[4/5] w-full items-end rounded-3xl p-4 sm:aspect-[16/10] sm:p-6\"\n      >\n        <div className=\"w-full max-w-xs rounded-2xl bg-white/75 p-4 text-zinc-950 shadow-sm ring-1 ring-white/60 backdrop-blur-xl sm:p-5 dark:bg-zinc-950/55 dark:text-white dark:ring-white/10\">\n          <p className=\"text-xs font-medium text-zinc-500 dark:text-zinc-400\">Tinta · {studio.city} studio</p>\n          <p className=\"mt-1 text-4xl font-medium tracking-[-0.03em] tabular-nums\">{hour === null ? \"--:--\" : clock(hour)}</p>\n          <p className=\"mt-1.5 flex items-center gap-1.5 text-sm text-zinc-600 dark:text-zinc-300\">\n            <span\n              aria-hidden\n              className={`size-1.5 rounded-full ${isOpen ? \"bg-emerald-500\" : \"bg-zinc-400 dark:bg-zinc-500\"}`}\n            />\n            {hour === null\n              ? studio.team\n              : isOpen\n                ? `Open until ${hourLabel(studio.open[1])} · ${studio.team}`\n                : `Closed · opens at ${hourLabel(studio.open[0])}`}\n          </p>\n          <p className=\"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400\">{studio.address}</p>\n          <a\n            href=\"#book\"\n            className=\"mt-4 inline-flex h-9 items-center rounded-full bg-zinc-950 px-4 text-sm font-medium text-white transition-[background-color,scale] duration-150 ease-out hover:bg-zinc-800 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-950 active:scale-[0.97] dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200 dark:focus-visible:outline-white\"\n          >\n            {isOpen || hour === null ? \"Book a call\" : \"Leave a note for the morning\"}\n          </a>\n        </div>\n      </GoldenHour>\n\n      <div\n        role=\"tablist\"\n        aria-label=\"Studios\"\n        className=\"mt-4 grid grid-cols-3 gap-1 rounded-2xl bg-zinc-100 p-1 dark:bg-white/[0.06]\"\n        onKeyDown={(event) => {\n          if (event.key === \"ArrowRight\") pick(picked + 1);\n          else if (event.key === \"ArrowLeft\") pick(picked - 1);\n          else return;\n          event.preventDefault();\n        }}\n      >\n        {STUDIOS.map((place, index) => {\n          const selected = index === picked;\n          return (\n            <button\n              key={place.city}\n              ref={(element) => {\n                tabs.current[index] = element;\n              }}\n              id={`golden-hour-studio-tab-${index}`}\n              type=\"button\"\n              role=\"tab\"\n              aria-selected={selected}\n              aria-controls=\"golden-hour-studio\"\n              tabIndex={selected ? 0 : -1}\n              onClick={() => setPicked(index)}\n              className={`flex flex-col items-start rounded-xl px-3 py-2 text-left transition-[background-color,box-shadow] duration-200 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-950 dark:focus-visible:outline-white ${\n                selected\n                  ? \"bg-white shadow-sm ring-1 ring-zinc-950/5 dark:bg-white/10 dark:ring-white/10\"\n                  : \"hover:bg-white/60 dark:hover:bg-white/[0.04]\"\n              }`}\n            >\n              <span className=\"text-sm font-medium text-zinc-950 dark:text-white\">{place.city}</span>\n              <span className=\"text-xs text-zinc-500 tabular-nums dark:text-zinc-400\">\n                {minute === null ? \"--:--\" : clock(hourIn(place.zone, minute))}\n              </span>\n            </button>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}