{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"cafe-footer-giant-local-time-on-rolling-digits","type":"registry:block","title":"Cafe Footer With Giant Local Time","description":"","dependencies":[],"files":[{"path":"components/we-inc/cafe-footer-giant-local-time-on-rolling-digits.tsx","type":"registry:component","content":"import { Fragment, useEffect, useRef } from \"react\";\nimport type { CSSProperties } from \"react\";\n\nconst ZONE = \"Europe/Lisbon\"; // time zone of the shop\nconst CITY = \"Lisbon\"; // city named next to the clock\nconst OPEN = 8; // opening hour, 24h clock\nconst CLOSE = 19; // closing hour, 24h clock\n\n// Same markup, styles and script as the plain HTML version.\nconst STYLES = `\n/* Change these: background, text, muted text, rule colour, accent (links' focus ring and highlights). */\n  .w4clk { --w4clk-bg: #9c3f25; --w4clk-ink: #f8eddf; --w4clk-muted: #f2dcc8; --w4clk-line: #b45a3e; --w4clk-accent: #ffe2b8; }\n  .w4clk { position: relative; overflow: hidden; background: var(--w4clk-bg); color: var(--w4clk-ink); font-family: ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif; padding: 72px clamp(20px, 4vw, 56px) 24px; }\n  .w4clk *, .w4clk *::before, .w4clk *::after { box-sizing: border-box; }\n  .w4clk-in { max-width: 1240px; margin: 0 auto; }\n  .w4clk-top { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 32px 40px; }\n  .w4clk-brand { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }\n  .w4clk-blurb { margin: 12px 0 0; max-width: 32ch; font-size: 15px; line-height: 1.6; color: var(--w4clk-muted); }\n  .w4clk-addr { margin: 16px 0 0; font-style: normal; font-size: 14px; line-height: 1.65; color: var(--w4clk-muted); }\n  .w4clk-col h2 { margin: 0 0 6px; font-size: 12px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--w4clk-muted); }\n  .w4clk-col ul, .w4clk-legal ul { list-style: none; margin: 0; padding: 0; }\n  .w4clk-col a, .w4clk-legal a { display: inline-flex; align-items: center; min-height: 40px; color: inherit; text-decoration: none; font-size: 15px; border-radius: 3px; }\n  .w4clk-col a:hover, .w4clk-legal a:hover { text-decoration: underline; text-underline-offset: 4px; }\n  .w4clk a:focus-visible { outline: 2px solid var(--w4clk-accent); outline-offset: 3px; }\n  .w4clk-big { container-type: inline-size; margin: 56px 0 0; }\n  .w4clk-legal { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 24px; margin-top: 24px; padding-top: 6px; border-top: 1px solid var(--w4clk-line); font-size: 13px; color: var(--w4clk-muted); }\n  .w4clk-legal p { margin: 10px 0; }\n  .w4clk-legal ul { display: flex; flex-wrap: wrap; gap: 0 20px; }\n  .w4clk-legal a { font-size: 13px; }\n  .w4clk-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n  @media (max-width: 760px) {\n    .w4clk { padding-top: 56px; }\n    .w4clk-top { grid-template-columns: 1fr 1fr; gap: 24px 20px; }\n    .w4clk-lead { grid-column: 1 / -1; }\n  }\n  /* Change these: clock size (cqi of the footer width) and how long a digit takes to roll. */\n  .w4clk { --w4clk-size: 25cqi; --w4clk-roll: 1.1s; }\n  .w4clk-label { margin: 0; text-align: center; font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--w4clk-muted); }\n  .w4clk-clock { display: flex; justify-content: center; margin: 4px 0 0; font: 650 var(--w4clk-size)/.9 ui-sans-serif, system-ui, -apple-system, \"Helvetica Neue\", Arial, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; }\n  .w4clk-reel { display: block; height: .9em; overflow: hidden; }\n  .w4clk-strip { display: block; transform: translateY(calc(var(--d) * -10%)); transition: transform var(--w4clk-roll) cubic-bezier(.7, 0, .18, 1); }\n  .w4clk-reel:nth-child(2) .w4clk-strip { transition-delay: .08s; }\n  .w4clk-reel:nth-child(4) .w4clk-strip { transition-delay: .16s; }\n  .w4clk-reel:nth-child(5) .w4clk-strip { transition-delay: .24s; }\n  .w4clk-strip span { display: block; height: .9em; text-align: center; }\n  .w4clk-colon { display: block; height: .9em; line-height: .8; padding: 0 .02em; animation: w4clk-blink 2s ease-in-out infinite; }\n  .w4clk[data-off] .w4clk-colon { animation-play-state: paused; }\n  @keyframes w4clk-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }\n  .w4clk-status { margin: 14px auto 0; max-width: 46ch; text-align: center; font-size: 16px; line-height: 1.5; }\n  @media (prefers-reduced-motion: reduce) { .w4clk-strip { transition: none; } .w4clk-colon { animation: none; } }\n`;\n\nexport default function CafeFooterGiantLocalTimeOnRollingDigits() {\n  const ref = useRef<HTMLElement>(null);\n  useEffect(() => {\n    const root: any = ref.current;\n    if (!root) return;\n    var strips = [].slice.call(root.querySelectorAll(\".w4clk-strip\"));\n    var label = root.querySelector(\".w4clk-label\"), status = root.querySelector(\".w4clk-status\");\n    var fmt = new Intl.DateTimeFormat(\"en-GB\", { timeZone: ZONE, hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" });\n    var timer = 0;\n    function two(n) { return (n < 10 ? \"0\" : \"\") + n; }\n    function show() {\n      clearTimeout(timer);\n      var t = fmt.format(new Date()).replace(/\\D/g, \"\");\n      for (var i = 0; i < 4; i++) strips[i].style.setProperty(\"--d\", t[i]);\n      var hr = +t.slice(0, 2), open = hr >= OPEN && hr < CLOSE;\n      label.textContent = \"Right now in \" + CITY;\n      status.textContent = \"It is \" + t.slice(0, 2) + \":\" + t.slice(2) + \" here. \" + (open ? \"We are open until \" + two(CLOSE) + \":00.\" : \"We are closed; doors open at \" + two(OPEN) + \":00.\");\n      /* wake again just after the next minute turns */\n      timer = setTimeout(show, 60050 - (Date.now() % 60000));\n    }\n    var io = new IntersectionObserver(function (en) {\n      if (en[0].isIntersecting) { root.removeAttribute(\"data-off\"); show(); }\n      else { root.setAttribute(\"data-off\", \"\"); clearTimeout(timer); }\n    });\n    io.observe(root);\n    return function () { clearTimeout(timer); io.disconnect(); };\n  }, []);\n\n  return (\n    <footer className=\"w4clk\" ref={ref}>\n      <style>{STYLES}</style>\n      <div className=\"w4clk-in\">\n        <div className=\"w4clk-top\">\n          <div className=\"w4clk-lead\">\n            <p className=\"w4clk-brand\">Rua Doce Café</p>\n            <p className=\"w4clk-blurb\">\n              Custard tarts at eight, bica all day, and a long marble counter facing the tram stop.\n            </p>\n            <address className=\"w4clk-addr\">\n              Rua das Flores 61, 1200-194 Lisboa\n              <br />\n              Every day, 08:00 to 19:00\n              <br />\n              +351 21 555 0148\n            </address>\n          </div>\n          <div className=\"w4clk-col\">\n            <h2>Café</h2>\n            <ul>\n              <li>\n                <a href=\"#\">Menu</a>\n              </li>\n              <li>\n                <a href=\"#\">Pastry times</a>\n              </li>\n              <li>\n                <a href=\"#\">Takeaway</a>\n              </li>\n            </ul>\n          </div>\n          <div className=\"w4clk-col\">\n            <h2>Visit</h2>\n            <ul>\n              <li>\n                <a href=\"#\">Directions</a>\n              </li>\n              <li>\n                <a href=\"#\">Seating</a>\n              </li>\n              <li>\n                <a href=\"#\">Private mornings</a>\n              </li>\n            </ul>\n          </div>\n          <div className=\"w4clk-col\">\n            <h2>Say olá</h2>\n            <ul>\n              <li>\n                <a href=\"#\">Write to us</a>\n              </li>\n              <li>\n                <a href=\"#\">Instagram</a>\n              </li>\n              <li>\n                <a href=\"#\">Work with us</a>\n              </li>\n            </ul>\n          </div>\n        </div>\n        <div className=\"w4clk-big\">\n          <p className=\"w4clk-label\">Doors open at</p>\n          <div className=\"w4clk-clock\" aria-hidden=\"true\">\n            {[0, 8, 0, 0].map((d, k) => (\n              <Fragment key={k}>\n                {k === 2 && <span className=\"w4clk-colon\">:</span>}\n                <span className=\"w4clk-reel\">\n                  <span className=\"w4clk-strip\" style={{ \"--d\": d } as CSSProperties}>\n                    {\"0123456789\".split(\"\").map((n) => <span key={n}>{n}</span>)}\n                  </span>\n                </span>\n              </Fragment>\n            ))}\n          </div>\n          <p className=\"w4clk-status\">Open every day from 08:00 until 19:00.</p>\n        </div>\n        <div className=\"w4clk-legal\">\n          <p>© 2026 Rua Doce, Lda. Prices include VAT.</p>\n          <ul>\n            <li>\n              <a href=\"#\">Privacy</a>\n            </li>\n            <li>\n              <a href=\"#\">Allergens</a>\n            </li>\n            <li>\n              <a href=\"#\">Complaints book</a>\n            </li>\n          </ul>\n        </div>\n      </div>\n    </footer>\n  );\n}\n"}]}
