{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"text-roll-button-with-letters-rolling-up","type":"registry:block","title":"Text Roll Button With Letters Rolling Up","description":"","dependencies":[],"files":[{"path":"components/we-inc/text-roll-button-with-letters-rolling-up.tsx","type":"registry:component","content":"import { useEffect, useRef } from \"react\";\n\nconst PRIMARY = \"Start an order\";\nconst SECONDARY = \"See the menu\";\nconst STAGGER = 22; // ms between letters\n\nexport default function TextRollButtonWithLettersRollingUp() {\n  const root = useRef<HTMLElement>(null);\n\n  // pauses the idle loop while the section is off screen\n  useEffect(() => {\n    const el = root.current;\n    if (!el) return;\n    const io = new IntersectionObserver(([en]) => { el.toggleAttribute(\"data-paused\", !en.isIntersecting); });\n    io.observe(el);\n    return () => io.disconnect();\n  }, []);\n\n  return (\n    <section ref={root} className=\"w3rol bg-white px-5 py-16 text-slate-900 sm:py-24\">\n      <style>{`\n        .w3rol-line { display: inline-flex; overflow: hidden; line-height: 1.5em; height: 1.5em; }\n        .w3rol-c { position: relative; display: inline-block; white-space: pre; transition: transform .5s cubic-bezier(.7,0,.2,1); transition-delay: calc(var(--i) * ${STAGGER}ms); }\n        .w3rol-c::after { content: attr(data-l); position: absolute; left: 0; top: 100%; }\n        .w3rol-btn:focus-visible .w3rol-c { transform: translateY(-100%); }\n        .w3rol-btn:focus-visible { outline: 2px solid #0f172a; outline-offset: 4px; }\n        @media (hover: hover) and (pointer: fine) { .w3rol-btn:hover .w3rol-c { transform: translateY(-100%); } }\n        /* idle demo: the first button rolls every few seconds; the copy below is identical, so the reset is invisible */\n        @keyframes w3rol-roll { 0%, 40% { transform: none; } 58% { transform: translateY(-100%); } 58.1%, 100% { transform: none; } }\n        .w3rol-demo .w3rol-c { animation: w3rol-roll 3.2s cubic-bezier(.7,0,.2,1) infinite; animation-delay: calc(var(--i) * ${STAGGER}ms); }\n        .w3rol:hover .w3rol-demo .w3rol-c, .w3rol:focus-within .w3rol-demo .w3rol-c { animation: none; }\n        .w3rol[data-paused] .w3rol-c { animation-play-state: paused; }\n        @media (prefers-reduced-motion: reduce) { .w3rol-c { transition: none; } .w3rol-demo .w3rol-c { animation: none; } }\n      `}</style>\n      <div className=\"mx-auto max-w-3xl\">\n        <p className=\"text-xs font-semibold uppercase tracking-[0.25em] text-slate-600\">Plainsong Coffee</p>\n        <h2 className=\"mt-4 text-3xl font-semibold leading-tight tracking-tight sm:text-5xl\">Order ahead, skip the queue on Mercer Street.</h2>\n        <p className=\"mt-5 max-w-xl text-base leading-relaxed text-slate-600\">Filter, espresso and a short list of pastries baked downstairs. Your cup is ready when the app says so.</p>\n        <div className=\"mt-10 flex flex-wrap items-center gap-4\">\n          <a href=\"#\" className=\"w3rol-btn w3rol-demo inline-flex h-14 items-center rounded-full bg-slate-900 px-8 text-base font-semibold text-white\">\n            <span className=\"sr-only\">{PRIMARY}</span>\n            <span aria-hidden=\"true\" className=\"w3rol-line\">\n              {PRIMARY.split(\"\").map((ch, i) => (\n                <span key={i} className=\"w3rol-c\" style={{ [\"--i\" as string]: i }} data-l={ch}>{ch}</span>\n              ))}\n            </span>\n          </a>\n          <a href=\"#\" className=\"w3rol-btn inline-flex h-14 items-center rounded-full border border-slate-300 px-8 text-base font-semibold text-slate-900\">\n            <span className=\"sr-only\">{SECONDARY}</span>\n            <span aria-hidden=\"true\" className=\"w3rol-line\">\n              <span className=\"w3rol-c\" style={{ [\"--i\" as string]: 0 }} data-l={SECONDARY}>{SECONDARY}</span>\n            </span>\n          </a>\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
