{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "playhead-reel-journal-demo",
  "type": "registry:block",
  "title": "Playhead Reel: Travel Journal",
  "description": "Timeline Scrub Gallery example, Travel Journal: A year of trips, one group each, in portrait and landscape. Each photo has its own caption, and the trip's dates and a day count sit above. A take on the horizontal scroll (filmstrip), timeline (history) and scroll animation (on scroll). Fits changelog, portfolio and blog sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "changelog",
    "portfolio",
    "blog",
    "horizontal-scroll",
    "timeline",
    "scroll-animation",
    "image-gallery",
    "carousel",
    "gallery",
    "scroll"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/playhead-reel#playhead-reel-journal-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/playhead-reel.json"
  ],
  "files": [
    {
      "path": "components/playhead-reel-journal-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\nimport { PlayheadReel, type PlayheadReelItem } from \"@/components/ui/playhead-reel\";\n\ntype Photo = PlayheadReelItem & { day: number };\ntype Trip = { label: string; place: string; dates: string; items: Photo[] };\n\nconst photo = (id: string, aspect: number, day: number, alt: string): Photo => ({\n  src: `https://images.unsplash.com/photo-${id}?auto=format&fit=crop&w=${Math.round(560 * aspect)}&h=560&q=65`,\n  aspect,\n  day,\n  alt,\n});\n\nconst trips: Trip[] = [\n  {\n    label: \"Portugal\",\n    place: \"Lisbon & Porto\",\n    dates: \"Mar 3 – 11\",\n    items: [\n      photo(\"1585208798174-6cedd86e019a\", 3 / 4, 1, \"Tram 28 through Baixa\"),\n      photo(\"1548707309-dcebeab9ea9b\", 4 / 3, 1, \"Under the Rua Augusta arch\"),\n      photo(\"1536663815808-535e2280d2c2\", 4 / 3, 2, \"Alfama rooftops\"),\n      photo(\"1525207934214-58e69a8f8a3e\", 3 / 2, 3, \"The city after dark\"),\n      photo(\"1555881400-74d7acaacd8b\", 4 / 3, 6, \"Ribeira, Porto\"),\n      photo(\"1513735492246-483525079686\", 3 / 2, 7, \"The bridge at sunset\"),\n    ],\n  },\n  {\n    label: \"Japan\",\n    place: \"Kyoto & Tokyo\",\n    dates: \"Apr 2 – 14\",\n    items: [\n      photo(\"1478436127897-769e1b3f0f36\", 3 / 4, 2, \"Fushimi Inari before the crowds\"),\n      photo(\"1493976040374-85c8e12f0c0e\", 3 / 4, 3, \"Higashiyama, early\"),\n      photo(\"1545569341-9eb8b30979d9\", 3 / 2, 3, \"Kyoto at dusk\"),\n      photo(\"1490806843957-31f4c9a91c65\", 4 / 3, 7, \"Fuji through the blossoms\"),\n      photo(\"1524413840807-0c3cb6fa808d\", 4 / 3, 9, \"Meguro River in bloom\"),\n      photo(\"1540959733332-eab4deabeeaf\", 4 / 3, 10, \"Tokyo, late\"),\n      photo(\"1503899036084-c55cdd92da26\", 3 / 4, 11, \"Signs on every floor\"),\n    ],\n  },\n  {\n    label: \"Dolomites\",\n    place: \"The Dolomites\",\n    dates: \"Jul 8 – 15\",\n    items: [\n      photo(\"1501785888041-af3ef285b470\", 4 / 3, 1, \"Lago di Braies\"),\n      photo(\"1506905925346-21bda4d32df4\", 3 / 2, 3, \"Above the clouds at sunrise\"),\n      photo(\"1464822759023-fed622ff2c3b\", 4 / 3, 4, \"Down the valley\"),\n      photo(\"1520769945061-0a448c463865\", 4 / 3, 5, \"Lunch by the lake\"),\n      photo(\"1486870591958-9b9d0d1dda99\", 3 / 4, 6, \"Snow in July\"),\n    ],\n  },\n  {\n    label: \"Iceland\",\n    place: \"Iceland\",\n    dates: \"Sep 19 – 27\",\n    items: [\n      photo(\"1474690870753-1b92efa1f2d8\", 3 / 4, 1, \"Hallgrímskirkja, Reykjavík\"),\n      photo(\"1476610182048-b716b8518aae\", 4 / 3, 2, \"Seljalandsfoss\"),\n      photo(\"1500043357865-c6b8827edf10\", 3 / 2, 3, \"Black sand at Reynisfjara\"),\n      photo(\"1504893524553-b855bce32c67\", 3 / 4, 4, \"Fjaðrárgljúfur canyon\"),\n      photo(\"1529963183134-61a90db47eaf\", 4 / 3, 5, \"Aurora over the lagoon\"),\n      photo(\"1531366936337-7c912a4589a7\", 4 / 3, 7, \"Northern lights, again\"),\n    ],\n  },\n  {\n    label: \"Big Sur\",\n    place: \"Big Sur\",\n    dates: \"Nov 6 – 10\",\n    items: [\n      photo(\"1510414842594-a61c69b5ae57\", 4 / 3, 1, \"McWay Falls\"),\n      photo(\"1505142468610-359e7d316be0\", 3 / 4, 2, \"Where the road meets the sea\"),\n      photo(\"1502680390469-be75c86b636f\", 4 / 3, 3, \"Morning swell\"),\n      photo(\"1473116763249-2faaef81ccda\", 3 / 2, 4, \"Last light on the coast\"),\n    ],\n  },\n];\n\nexport function PlayheadReelJournalDemo() {\n  const scrollRef = React.useRef<HTMLDivElement>(null);\n  const [view, setView] = React.useState({ group: 0, item: 0, direction: 1 });\n  const trip = trips[view.group];\n  const shot = trip.items[view.item];\n\n  return (\n    <div className=\"relative w-full overflow-hidden rounded-xl border border-stone-200 bg-stone-100 text-stone-900 dark:border-stone-800 dark:bg-stone-950 dark:text-stone-100\">\n      <div ref={scrollRef} className=\"relative h-[var(--demo-height,38rem)] overflow-y-auto overscroll-contain\">\n        <PlayheadReel\n          groups={trips}\n          containerRef={scrollRef}\n          stageClassName=\"h-[var(--demo-height,38rem)]\"\n          itemClassName=\"rounded-[2px] ring-[5px] ring-white dark:ring-stone-800\"\n          reach={2}\n          onActiveChange={({ group, item }) =>\n            setView((prev) => ({\n              group,\n              item,\n              direction: group * 100 + item >= prev.group * 100 + prev.item ? 1 : -1,\n            }))\n          }\n          header={\n            <header className=\"px-4 pt-5 pb-4 sm:px-8 sm:pt-7\">\n              <div className=\"flex items-center justify-between gap-4 font-mono text-[11px] tracking-widest text-stone-500 uppercase tabular-nums\">\n                <span>Journal · 2025</span>\n                <span>\n                  Trip {view.group + 1} of {trips.length}\n                </span>\n              </div>\n              <div className=\"mt-2 flex items-end justify-between gap-4\">\n                <Roll id={view.group} direction={view.direction} className=\"min-w-0\">\n                  <h2 className=\"truncate font-serif text-3xl leading-[1.15] italic sm:text-5xl\">{trip.place}</h2>\n                </Roll>\n                <Roll id={view.group} direction={view.direction} className=\"shrink-0\">\n                  <p className=\"pb-1 font-mono text-xs text-stone-500 tabular-nums sm:text-sm\">{trip.dates}</p>\n                </Roll>\n              </div>\n              <Roll id={view.group * 100 + view.item} direction={view.direction} className=\"mt-1\">\n                <p className=\"truncate text-sm leading-6 text-stone-500\">\n                  <span className=\"font-mono text-xs text-stone-400 tabular-nums\">Day {shot?.day}</span>\n                  <span aria-hidden className=\"px-2 text-stone-300 dark:text-stone-700\">\n                    /\n                  </span>\n                  {shot?.alt}\n                </p>\n              </Roll>\n            </header>\n          }\n        />\n      </div>\n    </div>\n  );\n}\n\n/** Rolls its content out and the next one in, up when moving forward and down when going back. */\nfunction Roll({\n  id,\n  direction,\n  className,\n  children,\n}: {\n  id: number;\n  direction: number;\n  className?: string;\n  children: React.ReactNode;\n}) {\n  const reduceMotion = useReducedMotion();\n  return (\n    <div className={cn(\"relative overflow-hidden\", className)}>\n      <AnimatePresence mode=\"popLayout\" initial={false} custom={direction}>\n        <motion.div\n          key={id}\n          custom={direction}\n          variants={{\n            enter: (d: number) => (reduceMotion ? { opacity: 0 } : { y: `${d * 100}%` }),\n            center: { y: 0, opacity: 1 },\n            exit: (d: number) => (reduceMotion ? { opacity: 0 } : { y: `${d * -100}%` }),\n          }}\n          initial=\"enter\"\n          animate=\"center\"\n          exit=\"exit\"\n          transition={{ duration: reduceMotion ? 0.2 : 0.5, ease: [0.23, 1, 0.32, 1] }}\n        >\n          {children}\n        </motion.div>\n      </AnimatePresence>\n    </div>\n  );\n}\n"
    }
  ]
}