"use client"; import Image from "next/image"; import { useEffect, useRef, useState } from "react"; import { Eyebrow, TextLink } from "./ui"; import buy from "@/assets/packbook/buy.webp"; import identify from "@/assets/packbook/identify.webp"; import pack from "@/assets/packbook/pack.webp"; import share from "@/assets/packbook/share.webp"; import wall from "@/assets/packbook/wall.webp"; import { projects } from "@/config/site"; import { cn } from "@/lib/utils"; const SCREENS = [ { src: wall, label: "Snap", alt: "PackBook gear wall with die-cut gear photos", }, { src: identify, label: "Identify", alt: "PackBook identifying a Petzl GRIGRI", }, { src: pack, label: "Pack", alt: "PackBook packing list with base weight by category", }, { src: share, label: "Share", alt: "PackBook share card for a trip" }, { src: buy, label: "Shop", alt: "PackBook gear detail with where-to-buy prices", }, ]; export function PackBookCard() { const [index, setIndex] = useState(0); const [hovering, setHovering] = useState(false); const [loaded, setLoaded] = useState(1); const rootRef = useRef(null); const go = (i: number) => { setLoaded((n) => Math.max(n, i + 2)); setIndex(i); }; // Flip through the app while the card is hovered. useEffect(() => { if (!hovering) return; const id = window.setInterval( () => setIndex((i) => { const next = (i + 1) % SCREENS.length; setLoaded((n) => Math.max(n, next + 2)); return next; }), 1800, ); return () => window.clearInterval(id); }, [hovering]); return (
{ if (e.pointerType !== "touch") { setLoaded((n) => Math.max(n, 3)); setHovering(true); } }} onPointerLeave={() => setHovering(false)} >
Side project ยท iOS

PackBook

Snap your gear. Pack it. Share it.

{SCREENS.map((s, i) => ( ))}
{projects.packbook.linkLabel}
{/* On a narrow card the dots tighten up to leave room for the link. */}
{SCREENS.map((s, i) => ( ))}
{projects.packbook.linkLabel}
); }