Extracts shared section blocks for use beyond the homepage
HomeSection becomes PageSection, since every page needs the same section frame, and gains a flushTop spacing for a block right below a page head. The framed photo next to text from the homepage About block becomes MediaText, and the accent label that four components wrote out by hand becomes Eyebrow, which can also render as a heading. The homepage renders exactly as before: a layout comparison of every element against master at three widths shows no differences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+49
@@ -0,0 +1,49 @@
|
||||
# Code Generation Plan — Unit 1: Shared blocks
|
||||
|
||||
Single source of truth for code generation of this unit. Workspace root: `K:\Development\SlpSoftware\Projects\AndreaSlopFotografie`; all code in `web/src/`. Branch `feature/over-mij-page`.
|
||||
|
||||
## Unit Context
|
||||
- **Requirements**: FR-OM-09 (`HomeSection` → `PageSection`), FR-OM-10 (shared media+text block), NFR-OM-02 (reuse, tokens, English comments), NFR-OM-03 (tests)
|
||||
- **Design**: [application-design.md](../../inception/application-design/application-design.md) — `Eyebrow` (Q2), `PageSection` + `flushTop`, `MediaText` layout-only (Q1)
|
||||
- **Dependencies**: none on other units; unit 2 builds on everything here
|
||||
- **Behavioural contract**: the homepage renders exactly as before — same DOM roles, names, texts, styles. Existing tests must pass unchanged except for renamed imports/names.
|
||||
- **No business logic, no new pure helpers** → no property-based tests in this unit (PBT rules N/A: no properties to test in layout components). Example-based component tests + axe.
|
||||
|
||||
## Steps
|
||||
|
||||
### Eyebrow
|
||||
- [x] **Step 1** — Create `components/Eyebrow/Eyebrow.tsx`: Chakra `Text` with `textStyle="eyebrow"`, `color="accent.deep"`, `mb={4}`, an `as` prop (`'p' | 'span' | 'h2' | 'h3' | 'h4'`, default `p`) and pass-through `TextProps`. Comment: why `accent.deep` (4.5:1).
|
||||
- [x] **Step 2** — Create `components/Eyebrow/Eyebrow.test.tsx`: renders a paragraph by default; with `as="h3"` it is a level-3 heading with that name and can carry an `id`; extra props (e.g. `mb`) pass through; axe clean.
|
||||
- [x] **Step 3** — Switch the four identical inline labels to `Eyebrow` (same output): `SectionHeading`, `PageIntro`, `ContactForm/ContactFormGate`, `home/Testimonials/TestimonialSlide` (only its shoot label, not the author line). Remove the then-duplicated contrast comments where `Eyebrow` now carries the reason.
|
||||
|
||||
### PageSection
|
||||
- [x] **Step 4** — Rename `components/HomeSection/` → `components/PageSection/` (`git mv` for the component and its test), rename the component and props type, update the doc comment to "a content section on any page".
|
||||
- [x] **Step 5** — Add `spacing="flushTop"`: no top padding, bottom padding as `default` (design `.section--flush-top`).
|
||||
- [x] **Step 6** — Update all importers: `home/AboutBlock`, `home/ContactSection`, `home/InstagramGrid`, `home/IntroGallery`, `home/Pricing/Pricing`, `home/Testimonials/Testimonials`.
|
||||
- [x] **Step 7** — Update `PageSection.test.tsx`: renamed; add a case for `flushTop` (top padding 0, bottom padding kept).
|
||||
|
||||
### MediaText
|
||||
- [x] **Step 8** — Create `components/MediaText/MediaText.tsx`: grid `1fr` → `1fr 1fr` from `lg`, gap `clamp(2rem, 6vw, 5.5rem)`, `alignItems="center"`; first column `Reveal` → `FramedImage image aspectRatio`; second column `Reveal` → `children`. Props: `image`, `aspectRatio`, `data-testid?`, `children`.
|
||||
- [x] **Step 9** — Create `components/MediaText/MediaText.test.tsx`: shows the image with its alt text and the children; photo comes before the text in DOM order; axe clean.
|
||||
- [x] **Step 10** — Switch `home/AboutBlock` to `PageSection` + `MediaText` (the text column keeps `SectionHeading`, the paragraphs and the link). `AboutBlock.test.tsx` passes unchanged.
|
||||
|
||||
### Verification and summary
|
||||
- [x] **Step 11** — Search for leftovers: no `HomeSection` references in `web/` (code, tests, comments); no duplicate component files.
|
||||
- [x] **Step 12** — Run `pnpm check` in `web/` (lint, format, typecheck/build, tests with coverage, audits, Lighthouse). Fix and rerun until green.
|
||||
- [x] **Step 13** — Visual check of the homepage against master in the browser (desktop and phone width): About block, section headings, page intro of a placeholder page, contact notice, testimonial label — no visible difference.
|
||||
- [x] **Step 14** — Update the shared reverse engineering docs where they name `HomeSection` (architecture, code-structure, api-documentation, component-inventory, code-quality-assessment: debt item resolved) and list `Eyebrow`, `MediaText`.
|
||||
- [x] **Step 15** — Write `aidlc-docs/features/over-mij-page/construction/shared-blocks/code/code-summary.md` (created/modified files, tests, verification outcome).
|
||||
- [ ] **Step 16** — Commit on `feature/over-mij-page` (no push until asked).
|
||||
|
||||
## Files
|
||||
- **Created**: `components/Eyebrow/Eyebrow.tsx`, `Eyebrow.test.tsx`; `components/MediaText/MediaText.tsx`, `MediaText.test.tsx`
|
||||
- **Renamed + modified**: `components/HomeSection/*` → `components/PageSection/PageSection.tsx`, `PageSection.test.tsx`
|
||||
- **Modified**: `components/SectionHeading/SectionHeading.tsx`, `components/PageIntro/PageIntro.tsx`, `components/ContactForm/ContactFormGate.tsx`, `components/home/Testimonials/TestimonialSlide.tsx`, `components/home/AboutBlock/AboutBlock.tsx`, `components/home/{ContactSection,InstagramGrid,IntroGallery,Pricing/Pricing,Testimonials/Testimonials}.tsx`
|
||||
- **Docs**: `aidlc-docs/_shared/reverse-engineering/*.md` (names), unit code summary
|
||||
|
||||
## Extension Compliance (unit 1)
|
||||
| Rule | Status | Rationale |
|
||||
|---|---|---|
|
||||
| SECURITY-10 | Compliant | No new dependencies |
|
||||
| Other SECURITY rules | N/A | Presentational refactor; no data, endpoints, headers or config |
|
||||
| PBT-01..10 | N/A | No pure functions or business logic in this unit; example-based component tests cover the layout contract (PBT-10 complementary testing applies in unit 2) |
|
||||
@@ -0,0 +1,31 @@
|
||||
# Code Summary — Unit 1: Shared blocks
|
||||
|
||||
Plan: [shared-blocks-code-generation-plan.md](../../plans/shared-blocks-code-generation-plan.md). Requirements: FR-OM-09, FR-OM-10, NFR-OM-02, NFR-OM-03.
|
||||
|
||||
## Created
|
||||
- `web/src/components/Eyebrow/Eyebrow.tsx` — accent label (`textStyle="eyebrow"`, `accent.deep`, `mb={4}`), `as` prop for `p`/`span`/`h2`–`h4`, other `TextProps` pass through
|
||||
- `web/src/components/Eyebrow/Eyebrow.test.tsx` — paragraph by default; as h3 a heading that names a region; props pass through; axe
|
||||
- `web/src/components/MediaText/MediaText.tsx` — framed photo next to a text column (`children`), stacked below `lg`, both columns in `Reveal`
|
||||
- `web/src/components/MediaText/MediaText.test.tsx` — photo and text shown, photo first in DOM order; axe
|
||||
|
||||
## Renamed and modified
|
||||
- `web/src/components/HomeSection/HomeSection.tsx` → `web/src/components/PageSection/PageSection.tsx` — renamed component/props; new `spacing="flushTop"` (no top padding, bottom padding as default)
|
||||
- `HomeSection.test.tsx` → `PageSection.test.tsx` — renamed; new case for `flushTop`
|
||||
|
||||
## Modified
|
||||
- `components/SectionHeading/SectionHeading.tsx`, `components/PageIntro/PageIntro.tsx`, `components/ContactForm/ContactFormGate.tsx`, `components/home/Testimonials/TestimonialSlide.tsx` — inline label replaced by `Eyebrow` (contrast comment now lives in `Eyebrow`)
|
||||
- `components/home/AboutBlock/AboutBlock.tsx` — uses `PageSection` + `MediaText`
|
||||
- `components/home/{ContactSection,InstagramGrid,IntroGallery,Pricing/Pricing,Testimonials/Testimonials}.tsx` — import `PageSection`
|
||||
- `aidlc-docs/_shared/reverse-engineering/*.md` — names updated (`PageSection`, `MediaText`, `Eyebrow`); `HomeSection` debt item removed
|
||||
|
||||
## Verification
|
||||
- **Leftovers**: no `HomeSection` in `web/` source, tests or comments
|
||||
- **`pnpm check`**: lint, format, typecheck/build, 55 test files / 250 tests, coverage thresholds, audits — passed. Lighthouse failed in the first run (mobile performance `/` 0.71, `/over-mij` 0.87) because a second production build was running at the same time on the same machine; rerun alone: passed — mobile `/` 0.82 (budget 0.8), other pages 0.94–0.95; desktop 0.99–1; accessibility 1 everywhere
|
||||
- **Homepage unchanged**: master and branch production builds compared in headless Chrome at 1440, 768 and 390 px (reduced motion, after scrolling through the page): tag, ids, `aria-labelledby`, alt, text, position, size and 21 computed styles of every element in `<main>` — 233/233 elements identical on `/`, identical on `/over-mij` and `/contact` (placeholders with `PageIntro`). The same comparison of master against itself is also identical, so the method is stable. (Byte-for-byte screenshots were not usable: they already differ between two runs of master, through image loading and timing.)
|
||||
|
||||
## Extension Compliance
|
||||
| Rule | Status | Rationale |
|
||||
|---|---|---|
|
||||
| SECURITY-10 | Compliant | No new dependencies |
|
||||
| Other SECURITY rules | N/A | Presentational refactor only |
|
||||
| PBT-01..10 | N/A | No pure functions or business logic in this unit |
|
||||
Reference in New Issue
Block a user