{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"course-rows-with-a-photo-band-splitting-open","type":"registry:block","title":"Course Rows With A Splitting Photo Band","description":"","dependencies":[],"files":[{"path":"components/we-inc/course-rows-with-a-photo-band-splitting-open.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\nconst DELAY = 1900; // ms between idle reveals while nobody is pointing or tabbing\n\nconst courses = [\n  { name: \"Dinghy sailing\", when: \"Saturdays, April to September\", img: \"https://images.pexels.com/photos/3686785/pexels-photo-3686785.jpeg?auto=compress&cs=tinysrgb&w=1200\", alt: \"A small sailing boat with a red and yellow sail on a calm grey sea\" },\n  { name: \"Lake kayaking\", when: \"Weekday evenings\", img: \"https://images.pexels.com/photos/5704472/pexels-photo-5704472.jpeg?auto=compress&cs=tinysrgb&w=1200\", alt: \"A kayaker paddling across a dark lake between wooded hills\" },\n  { name: \"Rowing for two\", when: \"Sunday mornings\", img: \"https://images.pexels.com/photos/5022032/pexels-photo-5022032.jpeg?auto=compress&cs=tinysrgb&w=1200\", alt: \"An empty white rowing boat with blue seats moored on still blue water\" },\n  { name: \"Paddleboarding\", when: \"Daily in July and August\", img: \"https://images.pexels.com/photos/7426234/pexels-photo-7426234.jpeg?auto=compress&cs=tinysrgb&w=1200\", alt: \"A paddleboarder seen from above on clear turquoise water\" },\n];\n\nconst css = `\n.w8sea-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 34px 20px; border-top: 1px solid #2a3a5c; color: #eef2f8; text-decoration: none; outline: none; isolation: isolate; }\n.w8sea-row:focus-visible { outline: 2px solid #f0c987; outline-offset: -2px; }\n.w8sea-half { position: absolute; left: 0; right: 0; height: 50%; overflow: hidden; z-index: -1; }\n.w8sea-top { top: 0; } .w8sea-bot { bottom: 0; }\n.w8sea-slide { position: absolute; inset: 0; transition: transform .75s cubic-bezier(.7,0,.2,1); }\n.w8sea-top .w8sea-slide { transform: translateY(-201%); } .w8sea-bot .w8sea-slide { transform: translateY(201%); }\n.w8sea-slide img { position: absolute; left: 0; width: 100%; height: 200%; max-width: none; object-fit: cover; }\n.w8sea-top img { top: 0; } .w8sea-bot img { top: -100%; }\n.w8sea-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(10,18,36,.78), rgba(10,18,36,.25)); opacity: 0; transition: opacity .5s ease .15s; }\n.w8sea-name { display: inline-block; transition: transform .6s cubic-bezier(.2,.8,.2,1); }\n.w8sea-row[data-on] .w8sea-slide, .w8sea-row:hover .w8sea-slide, .w8sea-row:focus-visible .w8sea-slide { transform: none; }\n.w8sea-row[data-on] .w8sea-shade, .w8sea-row:hover .w8sea-shade, .w8sea-row:focus-visible .w8sea-shade { opacity: 1; }\n.w8sea-row[data-on] .w8sea-name, .w8sea-row:hover .w8sea-name, .w8sea-row:focus-visible .w8sea-name { transform: translateX(12px); }\n.w8sea-thumb { display: none; }\n@media (max-width: 767px), (prefers-reduced-motion: reduce) {\n  .w8sea-half, .w8sea-shade { display: none; }\n  .w8sea-name { transform: none !important; transition: none; }\n  .w8sea-row { justify-content: flex-start; padding: 16px 0; }\n  .w8sea-thumb { display: block; flex: none; width: 96px; height: 64px; object-fit: cover; border-radius: 6px; }\n}\n`;\n\nexport default function CourseRowsWithAPhotoBandSplittingOpen() {\n  const root = useRef<HTMLElement>(null);\n  const [on, setOn] = useState(0);\n\n  useEffect(() => {\n    const el = root.current;\n    if (!el || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    let timer = 0, visible = true, live = true;\n    const run = () => {\n      window.clearInterval(timer);\n      timer = 0;\n      if (live && visible) timer = window.setInterval(() => setOn((n) => (n + 1) % courses.length), DELAY);\n    };\n    // a real mouse or keyboard takes over from the idle demo\n    const stop = () => { live = false; setOn(-1); run(); };\n    const enter = (e: PointerEvent) => { if (e.pointerType === \"mouse\") stop(); };\n    const io = new IntersectionObserver(([en]) => { visible = en.isIntersecting; run(); });\n    io.observe(el);\n    el.addEventListener(\"pointerenter\", enter);\n    el.addEventListener(\"focusin\", stop);\n    run();\n    return () => {\n      window.clearInterval(timer);\n      io.disconnect();\n      el.removeEventListener(\"pointerenter\", enter);\n      el.removeEventListener(\"focusin\", stop);\n    };\n  }, []);\n\n  return (\n    <section ref={root} className=\"bg-[#101b33] px-5 py-16 text-[#eef2f8] sm:py-20\">\n      <style>{css}</style>\n      <div className=\"mx-auto max-w-5xl\">\n        <p className=\"text-xs font-semibold uppercase tracking-[0.3em] text-[#f0c987]\">Saltmarsh Boat Club</p>\n        <h2 className=\"mt-3 text-3xl font-semibold tracking-tight sm:text-4xl\">Pick a way onto the water</h2>\n        <ul className=\"mt-10 border-b border-[#2a3a5c]\">\n          {courses.map((c, i) => (\n            <li key={c.name}>\n              <a href=\"#\" className=\"w8sea-row\" data-on={on === i ? \"\" : undefined}>\n                <span className=\"w8sea-half w8sea-top\" aria-hidden=\"true\"><span className=\"w8sea-slide\"><img src={c.img} alt=\"\" width={1200} height={800} loading=\"lazy\" decoding=\"async\" /></span></span>\n                <span className=\"w8sea-half w8sea-bot\" aria-hidden=\"true\"><span className=\"w8sea-slide\"><img src={c.img} alt=\"\" width={1200} height={800} loading=\"lazy\" decoding=\"async\" /></span></span>\n                <span className=\"w8sea-shade\" aria-hidden=\"true\" />\n                <img className=\"w8sea-thumb\" src={c.img} alt={c.alt} width={96} height={64} loading=\"lazy\" decoding=\"async\" />\n                <span className=\"mr-auto\">\n                  <span className=\"w8sea-name text-2xl font-semibold tracking-tight sm:text-4xl\">{c.name}</span>\n                  <span className=\"block text-sm text-[#c9d3e3] md:hidden\">{c.when}</span>\n                </span>\n                <span className=\"hidden text-sm text-[#c9d3e3] md:block\">{c.when}</span>\n              </a>\n            </li>\n          ))}\n        </ul>\n      </div>\n    </section>\n  );\n}\n"}]}
