# Components — Portfolio Page New and changed components, grouped by unit. Shared building blocks live in their own folder directly under `web/src/components/`; page-specific parts under `components/portfolio/` (same pattern as `components/home/` and `components/about/`). *Source: plan Q1 = A* ## Unit 1 — Shared Instagram block ### InstagramGrid (moved) - **From → to**: `components/home/InstagramGrid/` → `components/InstagramGrid/` - **Purpose**: the Instagram section (design `.instagram`): heading with the handle as link, full-width row of square tiles linking to the profile - **Change**: props type `HomeContent['instagram']` → `InstagramContent` (own content module). Markup, styling, test ids and behaviour unchanged - **Used by**: homepage route, portfolio route ## Unit 2 — Gallery building blocks (generic, no shoot types) ### PortfolioGrid (new, shared) - **Purpose**: masonry grid of photos in row order (design `.portfolio-grid` / `.portfolio-item`); every photo is a link to its large image that asks the page to open the lightbox instead - **Responsibilities**: - list semantics (`ul`/`li`) in the given order - CSS-only masonry: tiny implicit rows whose height scales with the column width (container units); each item spans the number of rows derived from its intrinsic width/height by a pure helper. *Source: Q6 = A, 6a = B (no hook for JS measuring)* - 3 / 2 / 1 columns on the theme breakpoints, gap `gridGap` - the first `eagerCount` images load immediately with `fetchPriority="high"`; the rest via `DeferredImage` - hover/focus effect (zoom + overlay, zoom off under reduced motion), focus ring above neighbours, `Reveal` fade-in - click / Enter on a tile: `preventDefault` and report the index; without JavaScript the link opens the large image - pointer enter / focus on a tile: report "intent" so the page can preload the lightbox code (Q7) - **Knows nothing about**: shoot types, filters, URL ### Lightbox (new, shared, lazily loaded) - **Purpose**: modal viewer over a list of gallery items (design `.lightbox`) - **Responsibilities**: - Chakra `Dialog` (controlled `open`), dark backdrop, accessible name; focus trap, Escape, inert background, scroll lock and focus return come from Chakra/Ark - shows the current item's large image (`object-fit: contain`), visible caption (if given), counter "n / total" - previous / next buttons (`iconControl`/`carouselControl` recipes, ≥ 44 px), ←/→ keys, swipe via `useSwipe`; wrap-around via a pure helper - polite announcement of the position when browsing - preloads the neighbouring large images; shows the (cached) thumb until the large image has loaded - hides prev/next/counter when there is one item - **Loaded**: with `React.lazy` on first open or on tile intent. *Source: Q7 = A* - **Knows nothing about**: grids, filters, shoot types ### FilterBar (new, shared) - **Purpose**: a row of single-choice filter controls - **Responsibilities**: group of toggle buttons (`role="group"` with an accessible name, each button `aria-pressed`, one tab stop per button), labels in eyebrow style, active one underlined in `accent.deep`; reports the chosen id; renders nothing for fewer than two options. *Source: Q2 = A, Q3 = A* - **Styling**: a new recipe `filterControl` (or a `filter` variant on the `link` recipe — decided in Code Generation, whichever keeps the eyebrow tokens in one place) - **Knows nothing about**: what is filtered ### useSwipe (new hook, extracted) - **Purpose**: horizontal swipe detection on touch devices, shared by the hero and the lightbox. *Source: Q5 = A* - **Responsibilities**: touch start/end handlers; decides via a pure helper (threshold 50 px, horizontal movement larger than vertical); calls `onPrev` / `onNext` - **Change to the hero**: `useHeroSlider` uses `useSwipe` instead of its inline handlers; behaviour identical (same threshold, same direction rules) ## Unit 3 — Portfolio page ### PortfolioGallery (new, page-specific, `components/portfolio/`) - **Purpose**: connects filter bar, grid and lightbox for the portfolio. *Source: Q1 = A* - **Responsibilities**: - receives the photos, the shoot types and the active filter (from the route) plus a callback to change it - derives the visible filters and the filtered photo list with pure helpers; maps photos to generic gallery items (caption = `shootLabel`) - holds the open state (which item, or closed) and resets it when the filter changes - announces the number of shown photos after a filter change - renders the section frame (`PageSection`, visually hidden h2) with `FilterBar`, `PortfolioGrid` and the lazily loaded `Lightbox` ### Route `routes/portfolio.tsx` (rewritten) - `validateSearch` → `{ shoot?: ShootTypeId }` (typed, allowlist check; agreed with soorten-fotoshoots) - `head()` → `pageHead('/portfolio')` + `ImageGallery` structured data - component: `PageIntro` → `PortfolioGallery` → `InstagramGrid`; changing the filter navigates with `replace: true`. *Source: Q4 = A* ### Content and types - `content/portfolioContent.ts` — intro texts and the 10 photos (`PortfolioContent`, `PortfolioPhoto`) - `content/instagramContent.ts` (unit 1) — `InstagramContent` - `content/types.ts` — the types above; `ShootTypeId` / `ShootType` arrive with the soorten-fotoshoots commit ### SEO - `seo.ts` — `galleryImages(...)` builder for the `ImageObject` list; uses `webPage()` from the contact-page commit - `sitePages.ts` — `/portfolio`: `indexed: true`, `ogImage` - `lighthouserc*.cjs` — `/portfolio` to the indexed paths