{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"photo-strip-marquee-with-captioned-frames","type":"registry:block","title":"Photo Strip Marquee With Captioned Frames","description":"","dependencies":[],"files":[{"path":"components/we-inc/photo-strip-marquee-with-captioned-frames.tsx","type":"registry:component","content":"import { useEffect, useRef, useState } from \"react\";\n\n// Photos from around an invented plant nursery. Each caption names what is in the frame.\nconst photos = [\n  { src: \"https://images.pexels.com/photos/12096571/pexels-photo-12096571.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Greenhouse aisle under a glass roof with rows of white hanging pots\", caption: \"The long house\" },\n  { src: \"https://images.pexels.com/photos/32532120/pexels-photo-32532120.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Young snapdragon seedlings in small pots on a tray\", caption: \"Spring seedlings\" },\n  { src: \"https://images.pexels.com/photos/16960870/pexels-photo-16960870.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Striped silver and green calathea leaves in soft light\", caption: \"Calathea\" },\n  { src: \"https://images.pexels.com/photos/6913563/pexels-photo-6913563.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Large leaved tropical plants in pots on a greenhouse shelf\", caption: \"Tropical bench\" },\n  { src: \"https://images.pexels.com/photos/33614722/pexels-photo-33614722.jpeg?auto=compress&cs=tinysrgb&w=600\", alt: \"Begonia leaves with white spots on a dark green surface\", caption: \"Spotted begonia\" },\n];\nconst SPEED = 48; // seconds per loop\n\nfunction Frames({ dup }: { dup?: boolean }) {\n  return (\n    <ul className=\"w3pho-group\" aria-hidden={dup ? \"true\" : undefined}>\n      {photos.map((p, i) => (\n        <li key={p.caption} className={i % 2 ? \"w3pho-low\" : \"\"}>\n          <figure className=\"w-[200px] sm:w-[240px]\">\n            <div className=\"aspect-[3/4] overflow-hidden rounded-xl bg-[#2a3d30]\">\n              <img src={p.src} alt={dup ? \"\" : p.alt} loading=\"eager\" width={240} height={320} className=\"h-full w-full object-cover\" />\n            </div>\n            <figcaption className=\"mt-3 flex items-baseline justify-between text-sm\">\n              <span className=\"font-medium text-[#eef1e6]\">{p.caption}</span>\n              <span className=\"font-mono text-xs text-[#a9bba6]\">0{i + 1}</span>\n            </figcaption>\n          </figure>\n        </li>\n      ))}\n    </ul>\n  );\n}\n\nexport default function PhotoStripMarqueeWithCaptionedFrames() {\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=\"w3pho overflow-hidden bg-[#1b2a21] py-20 text-[#eef1e6]\"\n      style={{ [\"--w3pho-speed\" as string]: `${SPEED}s` }}\n    >\n      <style>{`\n        .w3pho-view { overflow: hidden; }\n        .w3pho-track { display: flex; width: max-content; animation: w3pho-run var(--w3pho-speed) linear infinite; }\n        .w3pho-group { display: flex; align-items: flex-start; gap: 24px; padding: 0 24px 0 0; margin: 0; list-style: none; }\n        .w3pho-low { margin-top: 40px; }\n        .w3pho[data-paused] .w3pho-track, .w3pho[data-off] .w3pho-track, .w3pho-view:hover .w3pho-track { animation-play-state: paused; }\n        @keyframes w3pho-run { to { transform: translateX(-50%); } }\n        @media (prefers-reduced-motion: reduce) {\n          .w3pho-view { overflow-x: auto; scroll-snap-type: x mandatory; }\n          .w3pho-track { animation: none; padding: 0 20px; }\n          .w3pho-group li { scroll-snap-align: start; }\n          .w3pho-group[aria-hidden], .w3pho-toggle { display: none; }\n        }\n      `}</style>\n      <div className=\"mx-auto flex max-w-6xl flex-col gap-6 px-5 sm:flex-row sm:items-end sm:justify-between\">\n        <div>\n          <p className=\"text-xs font-semibold uppercase tracking-[0.25em] text-[#b9cf9a]\">Bramblecote Nursery</p>\n          <h2 className=\"mt-3 max-w-xl text-3xl font-semibold tracking-tight sm:text-4xl\">Three glasshouses, open to wander every weekend</h2>\n        </div>\n        <button\n          type=\"button\"\n          aria-pressed={paused}\n          onClick={() => setPaused((p) => !p)}\n          className=\"w3pho-toggle inline-flex h-11 shrink-0 items-center gap-2 self-start rounded-full bg-[#eef1e6] px-5 text-sm font-medium text-[#1b2a21] hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#eef1e6] focus-visible:ring-offset-2 focus-visible:ring-offset-[#1b2a21] sm:self-auto\"\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          {paused ? \"Play photos\" : \"Pause photos\"}\n        </button>\n      </div>\n      <div className=\"w3pho-view mt-12\">\n        <div className=\"w3pho-track\">\n          <Frames />\n          <Frames dup />\n        </div>\n      </div>\n    </section>\n  );\n}\n"}]}
