{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"announcement-bar-marquee-with-linked-notices","type":"registry:block","title":"Announcement Bar Marquee With Linked Notices","description":"","dependencies":[],"files":[{"path":"components/we-inc/announcement-bar-marquee-with-linked-notices.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// Short notices for an invented boot maker. Each one is a real link.\nconst notices = [\n  { label: \"Resoling for winter: book a slot before 30 November\", href: \"#\" },\n  { label: \"Read how a resole is done at our bench\", href: \"#\" },\n  { label: \"New in: the waxed canvas field tote\", href: \"#\" },\n  { label: \"Workshop open Tuesday to Saturday, 10 to 6\", href: \"#\" },\n];\nconst SPEED = 40; // seconds per loop\n\nfunction Notices({ dup }: { dup?: boolean }) {\n  return (\n    <ul className=\"w3ann-group\" aria-hidden={dup ? \"true\" : undefined}>\n      {notices.map((n) => (\n        <li key={n.label} className=\"flex items-center gap-10\">\n          <a\n            href={n.href}\n            tabIndex={dup ? -1 : undefined}\n            className=\"rounded-sm underline decoration-[#8e8a80] underline-offset-4 hover:decoration-[#f4f1ea] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#e3b45a]\"\n          >\n            {n.label}\n          </a>\n          <span aria-hidden=\"true\" className=\"text-[#8e8a80]\">/</span>\n        </li>\n      ))}\n    </ul>\n  );\n}\n\nexport default function AnnouncementBarMarqueeWithLinkedNotices() {\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=\"w3ann bg-[#f4f1ea] text-[#1d1b18]\"\n      style={{ [\"--w3ann-speed\" as string]: `${SPEED}s` }}\n    >\n      <style>{`\n        .w3ann-view { overflow: hidden; flex: 1; }\n        .w3ann-track { display: flex; width: max-content; animation: w3ann-run var(--w3ann-speed) linear infinite; }\n        .w3ann-group { display: flex; align-items: center; gap: 40px; padding: 0 40px 0 0; margin: 0; list-style: none; height: 44px; white-space: nowrap; font-size: 14px; }\n        .w3ann[data-paused] .w3ann-track, .w3ann[data-off] .w3ann-track, .w3ann-view:hover .w3ann-track, .w3ann-view:focus-within .w3ann-track { animation-play-state: paused; }\n        @keyframes w3ann-run { to { transform: translateX(-50%); } }\n        @media (prefers-reduced-motion: reduce) {\n          .w3ann-view { overflow-x: auto; }\n          .w3ann-track { animation: none; padding-left: 20px; }\n          .w3ann-group[aria-hidden], .w3ann-toggle { display: none; }\n        }\n      `}</style>\n      <div className=\"flex items-center bg-[#1d1b18] text-[#f4f1ea]\">\n        <div className=\"w3ann-view\">\n          <div className=\"w3ann-track\">\n            <Notices />\n            <Notices dup />\n          </div>\n        </div>\n        <button\n          type=\"button\"\n          aria-pressed={paused}\n          aria-label={paused ? \"Play announcements\" : \"Pause announcements\"}\n          onClick={() => setPaused((p) => !p)}\n          className=\"w3ann-toggle grid h-11 w-11 shrink-0 place-items-center border-l border-[#3a3732] hover:bg-[#2c2925] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#e3b45a]\"\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      <header className=\"border-b border-[#ddd6c8]\">\n        <div className=\"mx-auto flex max-w-6xl items-center justify-between px-5 py-5\">\n          <a href=\"#\" className=\"rounded font-serif text-xl font-semibold tracking-tight focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1d1b18]\">Fenwick Boot Co.</a>\n          <nav aria-label=\"Main\">\n            <ul className=\"hidden gap-8 text-sm font-medium text-[#3d3a34] sm:flex\">\n              {[\"Boots\", \"Repairs\", \"Care\", \"Our bench\"].map((l) => (\n                <li key={l}><a href=\"#\" className=\"rounded hover:text-[#1d1b18] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1d1b18]\">{l}</a></li>\n              ))}\n            </ul>\n          </nav>\n          <a href=\"#\" className=\"inline-flex h-10 items-center rounded-full bg-[#1d1b18] px-4 text-sm font-medium text-[#f4f1ea] hover:bg-[#3a3732] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#1d1b18] focus-visible:ring-offset-2\">Basket (0)</a>\n        </div>\n      </header>\n      <div className=\"mx-auto grid max-w-6xl gap-8 px-5 py-16 sm:py-20 md:grid-cols-2 md:items-end\">\n        <h1 className=\"font-serif text-4xl font-semibold leading-[1.1] tracking-tight sm:text-5xl\">Goodyear welted boots, stitched and resoled in one workshop.</h1>\n        <p className=\"max-w-md text-base leading-relaxed text-[#4a463e]\">Leather from two tanneries we visit each spring, cut and lasted by hand, and resoled at the same bench when the soles wear through.</p>\n      </div>\n    </section>\n  );\n}\n"}]}
