{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"opening-hours-ticker-with-full-timetable","type":"registry:block","title":"Opening Hours Ticker With Full Timetable","description":"","dependencies":[],"files":[{"path":"components/we-inc/opening-hours-ticker-with-full-timetable.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// One source of truth: the ticker and the timetable are both built from this list.\nconst hours = [\n  { day: \"Monday\", time: \"7:00 to 15:00\" },\n  { day: \"Tuesday\", time: \"7:00 to 15:00\" },\n  { day: \"Wednesday\", time: \"7:00 to 15:00\" },\n  { day: \"Thursday\", time: \"7:00 to 21:00\" },\n  { day: \"Friday\", time: \"7:00 to 21:00\" },\n  { day: \"Saturday\", time: \"8:00 to 16:00\" },\n  { day: \"Sunday\", time: \"Closed\" },\n];\nconst SPEED = 34; // seconds per loop\n\nfunction Strip({ dup }: { dup?: boolean }) {\n  return (\n    <span className=\"w3hrs-group\" aria-hidden={dup ? \"true\" : undefined}>\n      {hours.map((h) => (\n        <span key={h.day} className=\"inline-flex items-center gap-3\">\n          <span className=\"font-semibold text-[#f2c879]\">{h.day.slice(0, 3)}</span>\n          <span className={h.time === \"Closed\" ? \"text-[#9fb0c8]\" : \"text-[#e8edf5]\"}>{h.time}</span>\n          <span aria-hidden=\"true\" className=\"ml-7 h-1 w-1 rounded-full bg-[#5b6f8c]\" />\n        </span>\n      ))}\n    </span>\n  );\n}\n\nexport default function OpeningHoursTickerWithFullTimetable() {\n  const root = useRef<HTMLElement>(null);\n  const [paused, setPaused] = useState(false);\n  const [off, setOff] = useState(false);\n\n  useEffect(() => {\n    const el = root.current;\n    if (!el) return;\n    const io = new IntersectionObserver(([e]) => setOff(!e.isIntersecting));\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  return (\n    <section\n      ref={root}\n      data-paused={paused ? \"\" : undefined}\n      data-off={off ? \"\" : undefined}\n      className=\"w3hrs bg-[#0f1b2d] text-[#e8edf5]\"\n      style={{ [\"--w3hrs-speed\" as string]: `${SPEED}s` }}\n    >\n      <style>{`\n        .w3hrs-bar { display: flex; align-items: center; border-bottom: 1px solid #22334d; background: #0a1422; }\n        .w3hrs-view { flex: 1; overflow: hidden; }\n        .w3hrs-track { display: flex; width: max-content; animation: w3hrs-run var(--w3hrs-speed) linear infinite; }\n        .w3hrs-group { display: flex; align-items: center; gap: 28px; padding-right: 28px; height: 52px; white-space: nowrap; font-family: ui-monospace, Menlo, monospace; font-size: 14px; letter-spacing: .02em; }\n        .w3hrs[data-paused] .w3hrs-track, .w3hrs[data-off] .w3hrs-track, .w3hrs-bar:hover .w3hrs-track { animation-play-state: paused; }\n        @keyframes w3hrs-run { to { transform: translateX(-50%); } }\n        @media (prefers-reduced-motion: reduce) {\n          .w3hrs-bar { display: none; }\n        }\n      `}</style>\n      <div className=\"w3hrs-bar\">\n        <p className=\"hidden shrink-0 items-center gap-2 border-r border-[#22334d] px-5 text-xs font-semibold uppercase tracking-[0.2em] text-[#f2c879] sm:flex\">\n          <span aria-hidden=\"true\" className=\"h-2 w-2 rounded-full bg-[#7fd1a4]\" /> This week\n        </p>\n        <div className=\"w3hrs-view\" aria-hidden=\"true\">\n          <div className=\"w3hrs-track\">\n            <Strip />\n            <Strip dup />\n          </div>\n        </div>\n        <button\n          type=\"button\"\n          aria-pressed={paused}\n          aria-label={paused ? \"Play the hours ticker\" : \"Pause the hours ticker\"}\n          onClick={() => setPaused((p) => !p)}\n          className=\"grid h-[52px] w-[52px] shrink-0 place-items-center border-l border-[#22334d] text-[#e8edf5] hover:bg-[#15243a] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#f2c879]\"\n        >\n          <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\" className=\"fill-current\">\n            {paused ? <path d=\"M4 2.5v11l9-5.5z\" /> : <path d=\"M4 2.5h3v11H4zM9 2.5h3v11H9z\" />}\n          </svg>\n        </button>\n      </div>\n      <div className=\"mx-auto grid max-w-5xl gap-10 px-5 py-16 md:grid-cols-[1.1fr_1fr] md:gap-16 md:py-20\">\n        <div>\n          <p className=\"text-xs font-semibold uppercase tracking-[0.25em] text-[#f2c879]\">Pier Lane Coffee</p>\n          <h2 className=\"mt-4 text-3xl font-semibold leading-tight tracking-tight sm:text-4xl\">Late on Thursdays and Fridays, with soup and bread until close.</h2>\n          <p className=\"mt-5 max-w-md text-base leading-relaxed text-[#b8c4d6]\">Find us at 14 Pier Lane, two doors from the ferry ticket office. Dogs and prams are welcome inside.</p>\n        </div>\n        <div className=\"rounded-2xl border border-[#22334d] bg-[#132239] p-6\">\n          <h3 className=\"text-sm font-semibold uppercase tracking-[0.2em] text-[#9fb0c8]\">Opening hours</h3>\n          <dl className=\"mt-4 divide-y divide-[#22334d]\">\n            {hours.map((h) => (\n              <div key={h.day} className=\"flex justify-between py-2.5 text-[15px]\">\n                <dt className=\"text-[#e8edf5]\">{h.day}</dt>\n                <dd className={`font-mono ${h.time === \"Closed\" ? \"text-[#9fb0c8]\" : \"text-[#e8edf5]\"}`}>{h.time}</dd>\n              </div>\n            ))}\n          </dl>\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
