diff --git a/aidlc-docs/active-features.md b/aidlc-docs/active-features.md index 70ddf97..e44f7a8 100644 --- a/aidlc-docs/active-features.md +++ b/aidlc-docs/active-features.md @@ -4,4 +4,4 @@ |------|------|--------|--------|---------------------|---------------| | Bug | [hero-carousel-announce-and-pause](bugs/hero-carousel-announce-and-pause/bug-fix.md) | โœ… Complete | fix/hero-carousel-announce-and-pause | web/src/components/Hero (Hero, HeroArrows, useHeroSlider) | 2026-10-19 | | Feature | frontend-shell | โœ… Complete | feature/frontend-shell | web/src (AppShell, NavigationBar, Footer, Hero socials, new BackToTop/SkipLink/404/error pages, routes, theme.ts, main.tsx), web/vite.config.js, web/package.json | 2026-10-14 | -| Feature | homepage-sections | ๐Ÿ”ต Inception | feature/homepage-sections | web/src/routes/index.tsx, new homepage section components, web/src/content (types + static content), possibly web/config/securityHeaders.ts (contact form) | 2026-10-19 | +| Feature | homepage-sections | ๐ŸŸข Construction | feature/homepage-sections | web/src/routes/index.tsx, new homepage section components, web/src/content (types + static content), possibly web/config/securityHeaders.ts (contact form) | 2026-10-19 | diff --git a/aidlc-docs/features/homepage-sections/aidlc-state.md b/aidlc-docs/features/homepage-sections/aidlc-state.md index 6b62c84..952c15b 100644 --- a/aidlc-docs/features/homepage-sections/aidlc-state.md +++ b/aidlc-docs/features/homepage-sections/aidlc-state.md @@ -5,8 +5,8 @@ - **Feature Slug**: homepage-sections - **Project Type**: Brownfield - **Start Date**: 2026-10-19T19:19:38Z -- **Current Stage**: CONSTRUCTION - Unit 1 Lifestyle fotografie - Code Generation (awaiting approval) -- **Branch**: feature/homepage-sections (to be created before Code Generation) +- **Current Stage**: CONSTRUCTION - Unit 2 Over mij - Code Generation (awaiting approval) +- **Branch**: feature/homepage-sections ## Workspace State - **Existing Code**: Yes @@ -66,7 +66,7 @@ - [ ] NFR Requirements - SKIP - [ ] NFR Design - SKIP - [ ] Infrastructure Design - SKIP -- [ ] Code Generation - EXECUTE (per unit) +- [ ] Code Generation - EXECUTE (per unit) โ€” Unit 1 Lifestyle fotografie โœ… (approved) - [ ] Build and Test - EXECUTE ### ๐ŸŸก OPERATIONS PHASE @@ -74,8 +74,8 @@ ## Current Status - **Lifecycle Phase**: CONSTRUCTION -- **Current Stage**: Unit 1 Lifestyle fotografie โ€” Code Generation complete, awaiting approval -- **Next Stage**: CONSTRUCTION - Unit 1 Code Generation +- **Current Stage**: Unit 2 Over mij โ€” Code Generation complete, awaiting approval +- **Next Stage**: Unit 3 Prijzen โ€” Functional Design ## Reverse Engineering Status - [x] Reverse Engineering - Artifacts refreshed on 2026-10-19T19:19:38Z at commit 38c5c3e (approved 2026-10-19T19:31:00Z) diff --git a/aidlc-docs/features/homepage-sections/audit.md b/aidlc-docs/features/homepage-sections/audit.md index 576cd43..86c1ab9 100644 --- a/aidlc-docs/features/homepage-sections/audit.md +++ b/aidlc-docs/features/homepage-sections/audit.md @@ -257,3 +257,51 @@ Nou is het nog een statische site zonder back-end dus het contactformulier kan n **Context**: CONSTRUCTION - Unit 1 Code Generation (change applied, awaiting approval) --- + +## Unit 1 Lifestyle fotografie โ€” Approval + +**Timestamp**: 2026-10-20T00:35:00Z + +**User Input**: "ziet er goed uit, ga verder" + +**AI Response**: "Unit 1 approved. active-features.md updated to ๐ŸŸข Construction. Proceeding to Unit 2 Over mij (Functional Design skipped per plan) โ†’ Code Generation Part 1 Planning." + +**Context**: CONSTRUCTION - Unit 1 complete; Unit 2 start + +--- + +## Unit 2 Over mij โ€” Code Generation Plan + +**Timestamp**: 2026-10-20T00:45:00Z + +**User Input**: (none โ€” AI-initiated) + +**AI Response**: "Created construction/plans/over-mij-code-generation-plan.md (14 steps): original 1600px photo resized to 1200x800, HomeContent.about with RoutePath-typed link, link recipe 'underline' variant, SectionHeading compact spacing, FramedImage, AboutBlock, route + app test, pnpm check with visual check, summary, commit. PBT-01 N/A. Prompt: approve plan or request changes." + +**Context**: CONSTRUCTION - Unit 2 Code Generation Part 1 (awaiting plan approval) + +--- + +## Unit 2 Over mij โ€” Plan Approval + +**Timestamp**: 2026-10-20T00:50:00Z + +**User Input**: "approve plan" + +**AI Response**: "Plan approved. Starting Code Generation Part 2." + +**Context**: CONSTRUCTION - Unit 2 Code Generation Part 2 (start) + +--- + +## Unit 2 Over mij โ€” Code Generation Complete + +**Timestamp**: 2026-10-20T01:20:00Z + +**User Input**: (none โ€” generation) + +**AI Response**: "Executed all 14 steps. Step 13.5: Lighthouse home mobile failed (0.77). Root cause found by comparing observed LCP with deferred image request start across all runs: a race, photos starting before the observed LCP inflate Lighthouse's simulated LCP (5.3s vs 3.8s); the 600px load margin reached the gallery right after the load event. Lowered to a shared 200px DEFERRED_LOAD_MARGIN; latest runs request no below-hero photos on open. Final pnpm check green: 142 tests, mobile 0.84, desktop 1.0, a11y/BP/SEO 1.0. Visual check desktop + 390px phone. Committed locally (not pushed)." + +**Context**: CONSTRUCTION - Unit 2 Code Generation (complete, awaiting approval) + +--- diff --git a/aidlc-docs/features/homepage-sections/construction/over-mij/code/code-summary.md b/aidlc-docs/features/homepage-sections/construction/over-mij/code/code-summary.md new file mode 100644 index 0000000..716495f --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/over-mij/code/code-summary.md @@ -0,0 +1,37 @@ +# Code Summary โ€” Unit 2: Over mij + +Plan: [over-mij-code-generation-plan.md](../../plans/over-mij-code-generation-plan.md). Branch: `feature/homepage-sections`. + +## Files + +### Created +| File | Purpose | +|---|---| +| `web/src/assets/home/andrea.jpg` | Photo of Andrea, 1200ร—800, 75 KB (from the 1600ร—1067 original; the live site shows a 1024 px version) | +| `web/src/components/FramedImage/FramedImage.tsx` + test | Photo with the sand offset block behind it (CSS `::before`, hidden below `sm`); uses `DeferredImage` | +| `web/src/components/home/AboutBlock/AboutBlock.tsx` + test | The "Over mij" section | + +### Modified +| File | Change | +|---|---| +| `web/src/content/types.ts` | `HomeContent.about`; the link target is a `RoutePath` | +| `web/src/content/homeContent.ts` | About content (live texts, photo, link to `/over-mij`) | +| `web/src/recipes/link.ts` | New `underline` variant (design `.link-underline`), reused by later units | +| `web/src/components/SectionHeading/*` | `spacing="compact"` for a heading above running text | +| `web/src/components/DeferredImage/*`, `IntroGallery.tsx` | Load margin 600 px โ†’ **200 px**, shared constant `DEFERRED_LOAD_MARGIN` (see below) | +| `web/src/routes/index.tsx` | Renders `AboutBlock` after `IntroGallery` | +| `web/src/app.test.tsx` | Page-order check includes the "Over mij" section | + +## Fix during verification: deferred images raced the hero +The first `pnpm check` failed again on Lighthouse home mobile (0.77, LCP 5.3 s). Comparing all runs showed a race: when the gallery photos *started* before the observed LCP (164 ms vs 190 ms; 196 ms vs 219 ms) the simulated LCP was 5.3 s; when they started at or after it (221 ms vs 220 ms) it was 3.8 s. With a 600 px margin the gallery, ยฑ240 px below the full-height hero, was "near" right after the load event. With 200 px nothing below the hero is in range when the page opens; the latest runs request none of those photos (mobile 0.84, LCP 3.9 s; desktop 1.0), so the result no longer depends on timing. Photos load as the visitor scrolls towards them; the placeholder and the reveal fade cover the short wait. + +## Verification (`pnpm check`) +- Lint โœ…, Prettier โœ…, build โœ… +- Tests: 32 files, **142 passed** +- `audit:deps` โœ…; `audit:dev` report-only (unchanged) +- Lighthouse home: mobile **0.84**, desktop **1.0**; accessibility, best practices, SEO **1.0** on all URLs +- Visual check (CDP): desktop 1440 โ€” photo with sand block left, text right; phone 390 โ€” stacked, no block + +## Extension compliance +- **Security Baseline**: no new dependencies or external resources (SECURITY-10/13); internal link only; other rules N/A. +- **PBT**: PBT-01 N/A (no logic); PBT-10 example-based tests for FramedImage, AboutBlock and the SectionHeading variant. diff --git a/aidlc-docs/features/homepage-sections/construction/plans/over-mij-code-generation-plan.md b/aidlc-docs/features/homepage-sections/construction/plans/over-mij-code-generation-plan.md new file mode 100644 index 0000000..bfbe25d --- /dev/null +++ b/aidlc-docs/features/homepage-sections/construction/plans/over-mij-code-generation-plan.md @@ -0,0 +1,56 @@ +# Code Generation Plan โ€” Unit 2: Over mij + +**This plan is the single source of truth for Code Generation of unit 2.** + +## Unit context +- **Requirements**: FR-HP-03, FR-HP-11 (reveal, reused), FR-HP-12, NFR-HP-01/02/03/05/06 +- **Design**: [unit-of-work.md](../../inception/application-design/unit-of-work.md) unit 2; design reference `design/andreaslop-static/index.html` (`.about`, `.about__media`, `.about__body`, `.link-underline`) and `style.css` ยง5, ยง12 +- **Depends on**: unit 1 (`HomeSection`, `SectionHeading`, `Reveal`, `DeferredImage`, `ContentImage`, `homeContent.ts`) +- **Introduces**: `FramedImage` (reused by unit 4), the `underline` link variant (reused by units 5 and 6) +- **Functional Design**: skipped (presentational). **PBT-01**: N/A โ€” no business logic in this unit; example-based tests (PBT-10). +- Conventions as in unit 1 (English comments and test names, Dutch visitor text, `data-testid`, theme tokens, deferred images). + +## Steps + +### Image +- [x] **Step 1** โ€” Resize the original live photo of Andrea (`WhatsApp-Image-2024-10-27-at-14.31.42.jpeg`, 1600ร—1067; the live site shows the 1024 px version) to **1200ร—800**, quality 80, into `web/src/assets/home/andrea.jpg`, with the resize script from unit 1. + +### Content +- [x] **Step 2** โ€” `content/types.ts`: extend `HomeContent` with `about: { eyebrow; title; paragraphs: string[]; image: ContentImage; link: { label; to: RoutePath } }` (`RoutePath` from `navigation.ts`, so a wrong route is a type error). +- [x] **Step 3** โ€” `content/homeContent.ts`: eyebrow "Over mij", title "Lifestyle fotograaf met een passie voor storytelling", the three live paragraphs, the photo (alt "Andrea Slop met haar camera, glimlachend over haar schouder"), link "Lees mijn verhaal" โ†’ `/over-mij`. + +### Shared pieces +- [x] **Step 4** โ€” `recipes/link.ts`: add variant `underline` (design `.link-underline`): ink text, 1px underline in `currentColor` that slides in from the left on hover and focus, `interaction` duration, `smooth` easing, no motion under reduced motion. Used with `asChild` around `RouterLink`, like the footer menu. +- [x] **Step 5** โ€” `SectionHeading`: optional `spacing: 'default' | 'compact'` (compact = `1.5rem` below, design `.about__body h2`), so the about text can use the same heading block left-aligned. Test for the compact variant. +- [x] **Step 6** โ€” `components/FramedImage/FramedImage.tsx`: `DeferredImage` with a fixed `aspectRatio` on a `paper.deep` placeholder, plus the decorative sand block behind it (bottom-left, offset 1.5rem, 55% ร— 55%, `sand`), hidden below `sm`; the block is CSS only (`::before`), so it is never announced. +- [x] **Step 7** โ€” `components/FramedImage/FramedImage.test.tsx`: image with alt and dimensions, lazy, axe clean. + +### The section +- [x] **Step 8** โ€” `components/home/AboutBlock/AboutBlock.tsx`: `HomeSection` with `tone="alt"`; grid 1 column, 2 equal columns from `lg`, gap `clamp(2rem, 6vw, 5.5rem)`, vertically centred; left `FramedImage` (aspect 4/3) in a `Reveal`; right in a `Reveal`: `SectionHeading` (eyebrow, h2, start-aligned, compact), the paragraphs (`ink.soft`), and the link with the `underline` variant. +- [x] **Step 9** โ€” `components/home/AboutBlock/AboutBlock.test.tsx`: region named by the h2, eyebrow, three paragraphs, photo alt, link to `/over-mij`, axe clean. +- [x] **Step 10** โ€” `routes/index.tsx`: render `AboutBlock` after `IntroGallery`. +- [x] **Step 11** โ€” `app.test.tsx`: add the "Over mij" section (named by its h2) to the page-order check. + +### Verification and wrap-up +- [x] **Step 12** โ€” `pnpm check` (incl. Lighthouse); fix and rerun until green. Visual check at desktop width and at an emulated 390 px phone. +- [x] **Step 13** โ€” `construction/over-mij/code/code-summary.md`. +- [x] **Step 14** โ€” Commit on `feature/homepage-sections` ("Adds the Over mij section to the homepage" + attribution). Not pushed. + +### Fix during Step 12 +- [x] **Step 12a** โ€” Lighthouse home mobile 0.77: deferred photos started before the observed LCP whenever they won a race (600 px margin reached the gallery right after the load event). Load margin lowered to 200 px and shared as `DEFERRED_LOAD_MARGIN` (DeferredImage + IntroGallery); no photo below the hero is requested on page open any more. + +## Requirement traceability +| Requirement | Steps | +|---|---| +| FR-HP-03 | 2, 3, 6, 8โ€“11 | +| FR-HP-11 | 8 | +| FR-HP-12 | 1โ€“3 | +| NFR-HP-01 | 4, 6โ€“9, 11, 12 | +| NFR-HP-02 | 4โ€“8 | +| NFR-HP-03 | 5, 7, 9, 11, 12 | +| NFR-HP-05 | 1, 6, 12 | +| NFR-HP-06 | 2, 3 | + +## Extension compliance (planned) +- **Security**: no new dependencies or external resources; internal link only; other rules N/A. +- **PBT**: PBT-01 N/A (no logic); PBT-10 example-based tests present. diff --git a/web/src/app.test.tsx b/web/src/app.test.tsx index 8d17b11..1b2173d 100644 --- a/web/src/app.test.tsx +++ b/web/src/app.test.tsx @@ -129,6 +129,9 @@ describe('homepage', () => { }); const sections = [ screen.getByRole('region', { name: 'Lifestyle fotografie' }), + screen.getByRole('region', { + name: 'Lifestyle fotograaf met een passie voor storytelling', + }), ]; let previous: Element = hero; diff --git a/web/src/assets/home/andrea.jpg b/web/src/assets/home/andrea.jpg new file mode 100644 index 0000000..d9c1d4b Binary files /dev/null and b/web/src/assets/home/andrea.jpg differ diff --git a/web/src/components/DeferredImage/DeferredImage.test.tsx b/web/src/components/DeferredImage/DeferredImage.test.tsx index 2e70a93..b99ba09 100644 --- a/web/src/components/DeferredImage/DeferredImage.test.tsx +++ b/web/src/components/DeferredImage/DeferredImage.test.tsx @@ -2,7 +2,7 @@ import { act, screen } from '@testing-library/react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { FakeIntersectionObserver } from '@/test/fakeIntersectionObserver'; import { renderWithProviders } from '@/test/renderWithProviders'; -import DeferredImage from './DeferredImage'; +import DeferredImage, { DEFERRED_LOAD_MARGIN } from './DeferredImage'; const image = { src: '/foto.jpg', @@ -33,7 +33,7 @@ describe('DeferredImage', () => { const [observer] = FakeIntersectionObserver.instances; expect(img).not.toHaveAttribute('src'); - expect(observer.options?.rootMargin).toBe('600px 0px'); + expect(observer.options?.rootMargin).toBe(DEFERRED_LOAD_MARGIN); act(() => observer.trigger(true)); expect(img).toHaveAttribute('src', '/foto.jpg'); diff --git a/web/src/components/DeferredImage/DeferredImage.tsx b/web/src/components/DeferredImage/DeferredImage.tsx index d498b7a..a528b6e 100644 --- a/web/src/components/DeferredImage/DeferredImage.tsx +++ b/web/src/components/DeferredImage/DeferredImage.tsx @@ -3,8 +3,12 @@ import usePageLoaded from '@/hooks/usePageLoaded'; import useInView from '@/hooks/useInView'; import type { ContentImage } from '@/content/types'; -// How far below the viewport an image starts loading -const LOAD_MARGIN = '600px 0px'; +// How far outside the viewport an image starts loading. Kept small on +// purpose: everything below the full-height hero must be out of range when +// the page opens, or its photos start before the hero has painted. In +// Lighthouse's throttled simulation that pushed the largest contentful +// paint from 3.8 s to 5.3 s whenever the request won the race. +export const DEFERRED_LOAD_MARGIN = '200px 0px'; type DeferredImageProps = Omit & { image: ContentImage; @@ -26,7 +30,7 @@ export default function DeferredImage({ }: DeferredImageProps) { const pageLoaded = usePageLoaded(); const { ref, inView } = useInView({ - rootMargin: LOAD_MARGIN, + rootMargin: DEFERRED_LOAD_MARGIN, skip: near !== undefined, }); const load = pageLoaded && (near ?? inView); diff --git a/web/src/components/FramedImage/FramedImage.test.tsx b/web/src/components/FramedImage/FramedImage.test.tsx new file mode 100644 index 0000000..3d0e158 --- /dev/null +++ b/web/src/components/FramedImage/FramedImage.test.tsx @@ -0,0 +1,27 @@ +import { screen } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import FramedImage from './FramedImage'; + +const image = { + src: '/andrea.jpg', + alt: 'Andrea met haar camera', + width: 1200, + height: 800, +}; + +describe('FramedImage', () => { + it('renders only the photo for assistive technology, with its size', async () => { + const { container } = await renderWithProviders( + , + ); + const img = screen.getByRole('img'); + expect(img).toHaveAccessibleName('Andrea met haar camera'); + expect(img).toHaveAttribute('src', '/andrea.jpg'); + expect(img).toHaveAttribute('width', '1200'); + expect(img).toHaveAttribute('height', '800'); + expect(img).toHaveAttribute('loading', 'lazy'); + expect(await axeResults(container)).toHaveNoViolations(); + }); +}); diff --git a/web/src/components/FramedImage/FramedImage.tsx b/web/src/components/FramedImage/FramedImage.tsx new file mode 100644 index 0000000..1748dc0 --- /dev/null +++ b/web/src/components/FramedImage/FramedImage.tsx @@ -0,0 +1,45 @@ +import { Box } from '@chakra-ui/react'; +import DeferredImage from '@/components/DeferredImage/DeferredImage'; +import type { ContentImage } from '@/content/types'; + +type FramedImageProps = { + image: ContentImage; + // CSS aspect ratio of the visible crop, e.g. '4 / 3' + aspectRatio: string; +}; + +// A photo with a soft sand-coloured block offset behind its lower left +// corner (design .about__media). The block is pure decoration (a CSS +// pseudo-element), so assistive technology never announces it. On phones it +// is left out, since it would stick out past the page edge. +export default function FramedImage({ image, aspectRatio }: FramedImageProps) { + return ( + + + + ); +} diff --git a/web/src/components/SectionHeading/SectionHeading.test.tsx b/web/src/components/SectionHeading/SectionHeading.test.tsx index 004595f..0b456d9 100644 --- a/web/src/components/SectionHeading/SectionHeading.test.tsx +++ b/web/src/components/SectionHeading/SectionHeading.test.tsx @@ -31,4 +31,23 @@ describe('SectionHeading', () => { ).toBeInTheDocument(); expect(container.querySelectorAll('p')).toHaveLength(0); }); + + it('supports a compact, start-aligned variant above running text', async () => { + await renderWithProviders( + , + ); + expect( + screen.getByRole('heading', { + level: 2, + name: 'Lifestyle fotograaf', + }), + ).toHaveAttribute('id', 'about-title'); + expect(screen.getByText('Over mij')).toBeInTheDocument(); + }); }); diff --git a/web/src/components/SectionHeading/SectionHeading.tsx b/web/src/components/SectionHeading/SectionHeading.tsx index cedd9c5..0fdc4fa 100644 --- a/web/src/components/SectionHeading/SectionHeading.tsx +++ b/web/src/components/SectionHeading/SectionHeading.tsx @@ -7,6 +7,8 @@ type SectionHeadingProps = { eyebrow?: string; lead?: string; align?: 'center' | 'start'; + // compact: little space below, for a heading above running text + spacing?: 'default' | 'compact'; }; // Heading block of a homepage section (design .section__head): optional @@ -17,6 +19,7 @@ export default function SectionHeading({ eyebrow, lead, align = 'center', + spacing = 'default', }: SectionHeadingProps) { const centered = align === 'center'; @@ -24,7 +27,7 @@ export default function SectionHeading({ {eyebrow && ( diff --git a/web/src/components/home/AboutBlock/AboutBlock.test.tsx b/web/src/components/home/AboutBlock/AboutBlock.test.tsx new file mode 100644 index 0000000..dde06e4 --- /dev/null +++ b/web/src/components/home/AboutBlock/AboutBlock.test.tsx @@ -0,0 +1,31 @@ +import { screen, within } from '@testing-library/react'; +import { describe, expect, it } from 'vitest'; +import homeContent from '@/content/homeContent'; +import { axeResults } from '@/test/axe'; +import { renderWithProviders } from '@/test/renderWithProviders'; +import AboutBlock from './AboutBlock'; + +const about = homeContent.about; + +describe('AboutBlock', () => { + it('shows the label, heading, text, photo and link', async () => { + const { container } = await renderWithProviders( + , + ); + const section = screen.getByRole('region', { name: about.title }); + expect( + within(section).getByRole('heading', { level: 2 }), + ).toHaveTextContent(about.title); + expect(within(section).getByText(about.eyebrow)).toBeInTheDocument(); + about.paragraphs.forEach((paragraph) => + expect(within(section).getByText(paragraph)).toBeInTheDocument(), + ); + expect(within(section).getByRole('img')).toHaveAccessibleName( + about.image.alt, + ); + expect( + within(section).getByRole('link', { name: about.link.label }), + ).toHaveAttribute('href', '/over-mij'); + expect(await axeResults(container)).toHaveNoViolations(); + }); +}); diff --git a/web/src/components/home/AboutBlock/AboutBlock.tsx b/web/src/components/home/AboutBlock/AboutBlock.tsx new file mode 100644 index 0000000..bafbd2c --- /dev/null +++ b/web/src/components/home/AboutBlock/AboutBlock.tsx @@ -0,0 +1,55 @@ +import { Grid, Link, Stack, Text } from '@chakra-ui/react'; +import FramedImage from '@/components/FramedImage/FramedImage'; +import HomeSection from '@/components/HomeSection/HomeSection'; +import Reveal from '@/components/Reveal/Reveal'; +import RouterLink from '@/components/RouterLink'; +import SectionHeading from '@/components/SectionHeading/SectionHeading'; +import type { HomeContent } from '@/content/types'; + +const TITLE_ID = 'about-title'; + +type AboutBlockProps = { + content: HomeContent['about']; +}; + +// "Over mij": a framed photo of Andrea next to a short introduction with a +// link to the about page (design .about). Stacked on phones and tablets. +export default function AboutBlock({ content }: AboutBlockProps) { + return ( + + + + + + + + + {content.paragraphs.map((paragraph) => ( + {paragraph} + ))} + + + + {content.link.label} + + + + + + + + ); +} diff --git a/web/src/components/home/IntroGallery/IntroGallery.tsx b/web/src/components/home/IntroGallery/IntroGallery.tsx index 52d0a25..13d50a8 100644 --- a/web/src/components/home/IntroGallery/IntroGallery.tsx +++ b/web/src/components/home/IntroGallery/IntroGallery.tsx @@ -1,5 +1,7 @@ import { chakra, useBreakpointValue } from '@chakra-ui/react'; -import DeferredImage from '@/components/DeferredImage/DeferredImage'; +import DeferredImage, { + DEFERRED_LOAD_MARGIN, +} from '@/components/DeferredImage/DeferredImage'; import HomeSection from '@/components/HomeSection/HomeSection'; import Reveal from '@/components/Reveal/Reveal'; import SectionHeading from '@/components/SectionHeading/SectionHeading'; @@ -24,7 +26,7 @@ export default function IntroGallery({ content }: IntroGalleryProps) { // Photos outside the row are clipped by the scroller and never intersect // on their own, so the whole gallery decides when they load. const { ref, inView } = useInView({ - rootMargin: '600px 0px', + rootMargin: DEFERRED_LOAD_MARGIN, }); // Only the swipeable row scrolls, so only then is it a focus stop for // keyboard scrolling diff --git a/web/src/content/homeContent.ts b/web/src/content/homeContent.ts index 6a5a0f1..bb47b51 100644 --- a/web/src/content/homeContent.ts +++ b/web/src/content/homeContent.ts @@ -5,6 +5,7 @@ import intro1 from '../assets/home/intro-1.jpg'; import intro2 from '../assets/home/intro-2.jpg'; import intro3 from '../assets/home/intro-3.jpg'; import intro4 from '../assets/home/intro-4.jpg'; +import andrea from '../assets/home/andrea.jpg'; // Static content of the homepage sections until the CMS API exists; the API // will then deliver this object. @@ -39,6 +40,22 @@ const homeContent: HomeContent = { }, ], }, + about: { + eyebrow: 'Over mij', + title: 'Lifestyle fotograaf met een passie voor storytelling', + paragraphs: [ + 'Hi! Ik ben Andrea, lifestyle fotograaf uit Huizen. Leuk dat je een kijkje neemt op mijn website!', + "Foto's vertellen verhalen. Ze brengen je terug naar je favoriete momenten. Met mijn camera leg ik momenten vast die je voor altijd bij je houdt.", + 'Mijn stijl is natuurlijk en ongedwongen. Ik leg jullie vast zoals jullie zijn. Geen ongemakkelijke poses maar spontane momenten.', + ], + image: { + src: andrea, + alt: 'Andrea Slop met haar camera, glimlachend over haar schouder', + width: 1200, + height: 800, + }, + link: { label: 'Lees mijn verhaal', to: '/over-mij' }, + }, }; export default homeContent; diff --git a/web/src/content/types.ts b/web/src/content/types.ts index 852ab8a..29404dc 100644 --- a/web/src/content/types.ts +++ b/web/src/content/types.ts @@ -1,3 +1,4 @@ +import type { RoutePath } from '../navigation.ts'; import type { SocialPlatform } from './socialPlatforms.ts'; // Vorm van de content die straks uit de CMS-API komt. Bewust platte data @@ -37,6 +38,14 @@ export interface HomeContent { lead: string; photos: ContentImage[]; }; + about: { + eyebrow: string; + title: string; + paragraphs: string[]; + image: ContentImage; + // A route, so a wrong link is a type error + link: { label: string; to: RoutePath }; + }; } export interface HeroSlide { diff --git a/web/src/recipes/link.ts b/web/src/recipes/link.ts index e637079..fa7149f 100644 --- a/web/src/recipes/link.ts +++ b/web/src/recipes/link.ts @@ -17,6 +17,37 @@ const linkRecipe = defineRecipe({ _hover: { color: 'accent.deep' }, _focusVisible: { color: 'accent.deep' }, }, + // Ink text with an underline that slides in from the left on + // hover and focus (design .link-underline) + underline: { + position: 'relative', + display: 'inline-block', + color: 'ink', + textDecoration: 'none', + rounded: 'none', + _after: { + content: '""', + position: 'absolute', + left: 0, + bottom: '-2px', + width: '100%', + height: '1px', + bg: 'currentColor', + transform: 'scaleX(0)', + transformOrigin: 'right', + transitionProperty: 'transform', + transitionDuration: 'interaction', + transitionTimingFunction: 'smooth', + _motionReduce: { transition: 'none' }, + }, + _hover: { + textDecoration: 'none', + _after: { transform: 'scaleX(1)', transformOrigin: 'left' }, + }, + _focusVisible: { + _after: { transform: 'scaleX(1)', transformOrigin: 'left' }, + }, + }, }, }, }); diff --git a/web/src/routes/index.tsx b/web/src/routes/index.tsx index b44f043..423cd04 100644 --- a/web/src/routes/index.tsx +++ b/web/src/routes/index.tsx @@ -1,5 +1,6 @@ import { createFileRoute } from '@tanstack/react-router'; import Hero from '../components/Hero/Hero'; +import AboutBlock from '../components/home/AboutBlock/AboutBlock'; import IntroGallery from '../components/home/IntroGallery/IntroGallery'; import heroContent from '../content/heroContent'; import homeContent from '../content/homeContent'; @@ -17,6 +18,7 @@ function Index() { <> + ); }