Shows the Lifestyle fotografie photos as a swipeable row on phones

Four stacked photos were too much on a phone screen. Below the small
breakpoint the gallery is now a scroll-snap row with one photo at a
time and the next one peeking in; tablets and desktops keep the grid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 00:14:47 +02:00
co-authored by Claude Opus 5.5
parent b2717df049
commit 3e530df0af
9 changed files with 149 additions and 55 deletions
@@ -30,6 +30,14 @@ Plan: [lifestyle-fotografie-code-generation-plan.md](../../plans/lifestyle-fotog
## Deviation from the plan (Step 18a)
The first `pnpm check` failed on Lighthouse home mobile performance (0.78, budget 0.8). The LCP rose from 3.8 s to 5.3 s because Chrome fetches `loading="lazy"` images within ±1250 px of the viewport straight away: the gallery photos right under the hero were downloaded together with the first hero photo and, under Lighthouse's throttling, took its bandwidth. `DeferredImage` now holds back the `src` until the page has loaded and the image is near the viewport. Every later unit uses it for its photos.
## Change request after review: swipeable row on phones
Requested: on phones the four photos stacked vertically were too much; show one at a time and swipe to the next.
- `IntroGallery` now renders the photos as a list (`ul` named "Foto's"). Below `sm` it is a full-bleed row with CSS scroll snap: each photo 85% of the width, centred on snap, the next one peeking in; scrollbar hidden; the list is focusable (`tabIndex=0`, only while it scrolls, via `useBreakpointValue`) so keyboard users can scroll it with the arrow keys. From `sm` the grid (2 / 4 columns, staggered offsets) is unchanged.
- Photos clipped by the scroller never intersect on their own, so the gallery observes its list once (`useInView`, 600 px margin) and passes `near` to each `DeferredImage` (new optional prop). The gallery now fades in as one block instead of per photo.
- Static design updated to match (`style.css`, ≤ 680 px); FR-HP-02 updated.
- Verified at an emulated 390×844 phone via the Chrome DevTools Protocol (one photo with the next peeking in; second photo snaps to the centre after swiping).
- `pnpm check` green: **139 tests**, Lighthouse home mobile **0.84** (LCP 3.9 s), desktop **1.0**, accessibility/best practices/SEO **1.0**.
## Image script
Images are resized with a one-off PowerShell script (not part of the project; .NET `System.Drawing`, Windows). Command used:
@@ -63,6 +63,9 @@
### Fix during Step 18 (Step 13.5 self-check)
- [x] **Step 18a** — Lighthouse home mobile failed (0.78 < 0.8; LCP 3.8 s → 5.3 s). Root cause: Chrome fetches `loading="lazy"` images within ±1250 px of the viewport immediately, so the gallery photos right under the hero competed with the hero for bandwidth under Lighthouse's throttling. Fix: `hooks/useInView.ts` (shared observer logic; `useReveal` now builds on it), `hooks/usePageLoaded.ts`, `components/DeferredImage` (sets `src` only after the load event and when within 600 px of the viewport; width/height reserve the space), `test/fakeIntersectionObserver.ts` (shared test double); IntroGallery uses DeferredImage with a `paper.deep` placeholder. Result: mobile 0.85 (LCP 3.8 s, equal to master).
### Change request at review
- [x] **Step 21** — Phones: one photo at a time in a swipeable scroll-snap row with the next photo peeking in; keyboard-scrollable list; gallery-level loading via `DeferredImage near`; static design and FR-HP-02 updated; `pnpm check` green.
## Requirement traceability
| Requirement | Steps |
|---|---|