Files
SluijsensandClaude Opus 5.5 b35b1c2404 Plans the portfolio page
Records the requirements, execution plan and application design for the
portfolio page: the ten live photos in a filterable masonry grid with an
accessible lightbox, filters per shoot type in the URL, the Instagram
block shared with the homepage, and an indexed page with image gallery
structured data. Built alongside the contact and shoot type pages, with
shared pieces split between them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:32:48 +01:00

4.1 KiB
Raw Permalink Blame History

Component Methods — Portfolio Page

Signatures only; the rules behind them (edge cases, invariants, properties) follow in Functional Design for units 2 and 3. Types are TypeScript; names are working names.

Types

// content/types.ts (unit 2: GalleryItem lives next to ContentImage)
interface ImageSource { src: string; width: number; height: number }

// What the generic components show
interface GalleryItem {
    id: string;
    thumb: ContentImage;       // grid size (~800 px), alt text included
    full: ImageSource;         // lightbox size (~1600–2000 px), same alt as thumb
    caption?: string;          // visible caption in the lightbox
}

// unit 3
interface PortfolioPhoto {
    id: string;
    shootType: ShootTypeId;    // from the soorten-fotoshoots commit
    thumb: ContentImage;
    full: ImageSource;
}
interface PortfolioContent {
    intro: { eyebrow: string; title: string; text: string };
    photos: PortfolioPhoto[];
}

// unit 1
interface InstagramContent {
    title: string;
    handle: string;
    photos: ContentImage[];
}

interface FilterOption { id: string; label: string }

Components (props)

// unit 1
InstagramGrid({ content: InstagramContent; profileUrl: string })

// unit 2
PortfolioGrid({
    items: readonly GalleryItem[];
    eagerCount?: number;                 // default 3
    onOpen: (index: number) => void;
    onIntent?: () => void;               // hover/focus: preload the lightbox code
    'data-testid'?: string;
})

Lightbox({
    items: readonly GalleryItem[];
    index: number | null;                // null = closed
    onIndexChange: (index: number) => void;
    onClose: () => void;
    label?: string;                      // dialog name, default "Foto groot bekijken"
    finalFocusRef?: RefObject<HTMLElement> // or a getter for the tile to return to
})

FilterBar({
    options: readonly FilterOption[];
    value: string;
    onChange: (id: string) => void;
    label: string;                       // group name, e.g. "Filter op soort shoot"
})

// unit 3
PortfolioGallery({
    photos: readonly PortfolioPhoto[];
    shootTypes: readonly ShootType[];
    shoot: ShootTypeId | undefined;      // active filter from the route
    onShootChange: (shoot: ShootTypeId | undefined) => void;
})

Hooks

// hooks/useSwipe.ts (unit 2)
useSwipe(options: { onPrev: () => void; onNext: () => void; enabled?: boolean }):
    { onTouchStart: TouchEventHandler; onTouchEnd: TouchEventHandler }

Pure helpers (lib/, 100% coverage threshold, example + property-based tests)

// unit 2
wrapIndex(index: number, count: number): number
    // position within 0..count-1, wrapping both ways (also used by useHeroSlider)
swipeDirection(start: Point, end: Point, threshold?: number): 'prev' | 'next' | null
masonryRowSpan(image: { width: number; height: number }, rowsPerColumnWidth: number): number
    // number of implicit rows an item spans, from its aspect ratio
neighbourIndexes(index: number, count: number): number[]
    // which large images to preload around the current one

// unit 3
shootTypesWithPhotos(shootTypes: readonly ShootType[], photos: readonly PortfolioPhoto[]): ShootType[]
    // in list order; also offered to soorten-fotoshoots
shootFromSearch(value: unknown, available: readonly ShootTypeId[]): ShootTypeId | undefined
    // allowlist check for ?shoot= (like packageFromSearch)
filterPhotos(photos: readonly PortfolioPhoto[], shoot: ShootTypeId | undefined): PortfolioPhoto[]
filterOptions(shootTypes: readonly ShootType[], allLabel: string): FilterOption[]
    // "Alles" first, then one option per shoot type (label = name)
toGalleryItems(photos: readonly PortfolioPhoto[], shootTypes: readonly ShootType[]): GalleryItem[]
    // caption = shootLabel
photoCountLabel(count: number): string     // "1 foto" / "4 foto's"

SEO (seo.ts, unit 3)

galleryImages(photos: readonly PortfolioPhoto[], base?: string): ImageObject[]
    // contentUrl/thumbnailUrl absolute https, description = alt, creator → personId, copyrightHolder → businessId
// head: structuredDataScript(webPage('ImageGallery', '/portfolio', { associatedMedia: galleryImages(...) }))