{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"outlined-word-marquee-rows-in-opposite-directions","type":"registry:block","title":"Outlined Word Marquee Rows In Opposite Directions","description":"","dependencies":[],"files":[{"path":"components/we-inc/outlined-word-marquee-rows-in-opposite-directions.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// Two rows of big words for a neighbourhood bakery. The top row runs left, the bottom row runs right.\nconst rowA = [\"Country sourdough\", \"Seeded rye\", \"Morning buns\", \"Spelt loaf\"];\nconst rowB = [\"Baked before six\", \"Milled nearby\", \"Long ferment\", \"Wood fired\"];\nconst SPEED = 42; // seconds per loop; the second row runs a little slower\n\nfunction Row({ words, dir }: { words: string[]; dir: \"l\" | \"r\" }) {\n  const group = (dup: boolean) => (\n    <span className=\"w3wrd-group\" aria-hidden={dup ? \"true\" : undefined}>\n      {words.map((w, i) => (\n        <span key={w} className=\"flex items-center gap-8 sm:gap-12\">\n          <span className={i % 2 ? \"w3wrd-line\" : \"w3wrd-fill\"}>{w}</span>\n          <svg viewBox=\"0 0 20 20\" width=\"20\" height=\"20\" aria-hidden=\"true\" className=\"shrink-0 fill-[#b5562f]\"><circle cx=\"10\" cy=\"10\" r=\"6\" /></svg>\n        </span>\n      ))}\n    </span>\n  );\n  return (\n    <div className={`w3wrd-track w3wrd-${dir}`}>\n      {group(false)}\n      {group(true)}\n    </div>\n  );\n}\n\nexport default function OutlinedWordMarqueeRowsInOppositeDirections() {\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=\"w3wrd overflow-hidden bg-[#f3ece0] py-16 text-[#2b2118] sm:py-20\"\n      style={{ [\"--w3wrd-speed\" as string]: `${SPEED}s` }}\n    >\n      <style>{`\n        .w3wrd-view { overflow: hidden; }\n        .w3wrd-track { display: flex; width: max-content; animation: w3wrd-run var(--w3wrd-speed) linear infinite; }\n        .w3wrd-r { animation-direction: reverse; animation-duration: calc(var(--w3wrd-speed) * 1.25); }\n        .w3wrd-group { display: flex; align-items: center; gap: 2rem; padding-right: 2rem; white-space: nowrap; font-family: ui-serif, Georgia, serif; font-size: clamp(44px, 8vw, 104px); line-height: 1.1; letter-spacing: -0.03em; }\n        @media (min-width: 640px) { .w3wrd-group { gap: 3rem; padding-right: 3rem; } }\n        .w3wrd-fill { color: #2b2118; }\n        .w3wrd-line { color: transparent; -webkit-text-stroke: 1.5px #2b2118; font-style: italic; }\n        .w3wrd[data-paused] .w3wrd-track, .w3wrd[data-off] .w3wrd-track, .w3wrd-view:hover .w3wrd-track { animation-play-state: paused; }\n        @keyframes w3wrd-run { to { transform: translateX(-50%); } }\n        @media (prefers-reduced-motion: reduce) {\n          .w3wrd-track { animation: none; width: auto; padding: 0 20px; }\n          .w3wrd-group { flex-wrap: wrap; white-space: normal; row-gap: 0; font-size: clamp(34px, 6vw, 64px); }\n          .w3wrd-group[aria-hidden] { display: none; }\n          .w3wrd-toggle, .w3wrd-r { display: none; }\n        }\n      `}</style>\n      <div className=\"mx-auto flex max-w-6xl flex-col gap-2 px-5 sm:flex-row sm:items-end sm:justify-between\">\n        <h2 className=\"text-sm font-semibold uppercase tracking-[0.25em] text-[#7a4a2c]\">Hollis Street Bakery</h2>\n        <p className=\"max-w-sm text-base leading-relaxed text-[#4a3b2e]\">Country sourdough, seeded rye, spelt and morning buns, from a wood oven lit at four.</p>\n      </div>\n      <div className=\"w3wrd-view mt-10 space-y-2 sm:mt-14\" aria-hidden=\"true\">\n        <Row words={rowA} dir=\"l\" />\n        <Row words={rowB} dir=\"r\" />\n      </div>\n      <div className=\"mx-auto mt-10 flex max-w-6xl px-5\">\n        <button\n          type=\"button\"\n          aria-pressed={paused}\n          onClick={() => setPaused((p) => !p)}\n          className=\"w3wrd-toggle inline-flex h-11 items-center gap-2 rounded-full bg-[#2b2118] px-5 text-sm font-medium text-[#f3ece0] hover:bg-[#3d2f23] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2b2118] focus-visible:ring-offset-2 focus-visible:ring-offset-[#f3ece0]\"\n        >\n          {paused ? \"Play the words\" : \"Pause the words\"}\n        </button>\n      </div>\n    </section>\n  );\n}\n"}]}
