Files
SluijsensandClaude Sonnet 5.5 7a5e713b69
Continuous Integration / check (pull_request) Successful in 1m45s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 8m44s
Continuous Integration / deploy-production (pull_request) Skipped
Adds the AI-DLC documents of the testimonials redesign
Requirements, execution plan, functional design, code summaries, build and test results and the audit log; the reverse-engineering notes and the feature registry are updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 01:24:15 +01:00

8.3 KiB

Frontend Components: testimonials (unit 2)

Visual reference: the design canvas https://claude.ai/artifact/BEDx5KkBVMKXs6bjzoNoew (desktop 1440 px, phone 390 px). Decisions of the owner after the canvas: tablet and phone share the stacked layout (question 1 = A), the card grows with its text (question 2 = A), no sand block (question 3 = A).

Component hierarchy

graph TD
    Route["routes/index.tsx"]
    T["Testimonials"]
    Section["PageSection tone alt"]
    Heading["SectionHeading"]
    Holder["Box with view observer"]
    Placeholder["CarouselPlaceholder"]
    Carousel["TestimonialCarousel, lazy"]
    Slide["TestimonialSlide"]
    Photo["DeferredImage with crop"]
    Card["Card: shoot, quote, names"]
    Controls["Control bar: prev, counter, next"]
    Live["Live region"]
    Lib["lib: visibleTestimonials, slideLabel, slideCounter, normalizeImagePosition"]
    Recipe["carouselControl recipe"]

    Route --> T
    T --> Section
    Section --> Heading
    Section --> Holder
    Holder --> Placeholder
    Holder --> Carousel
    Placeholder --> Slide
    Carousel --> Slide
    Carousel --> Controls
    Carousel --> Live
    Slide --> Photo
    Slide --> Card
    Controls --> Recipe
    Lib -.-> T
    Lib -.-> Carousel
    Lib -.-> Slide

    classDef root fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000;
    classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000;
    classDef logic fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000;
    class Route root;
    class T,Section,Heading,Holder,Placeholder,Carousel,Slide,Photo,Card,Controls,Live,Recipe ui;
    class Lib logic;

Text alternative: the home route renders Testimonials in a PageSection with SectionHeading; a view-observing box shows either the placeholder or the lazy carousel, both made of TestimonialSlide (a cropped photo and a card), and the carousel adds the control bar and the live region; pure helpers feed all of them.

Testimonials (changed a little)

  • Props: unchanged, { content: HomeContent['testimonials']; testimonials: Testimonial[] }.
  • Behaviour: unchanged: visibleTestimonials; none gives null; one gives a single TestimonialSlide; two or more give the box with the view observer, the placeholder first and the lazy carousel once near the screen.
  • Section: PageSection with tone="alt" (decision FR-TR-10), data-testid="testimonials", centred SectionHeading with the unit 1 style.

TestimonialSlide (rebuilt)

  • Props: { testimonial: Testimonial }.
  • Wrapper: data-testid="testimonial-{id}".

From lg (1024 px)

One grid cell holds two stacked layers, so the row is as high as the higher one:

Part Placement
Photo Left, 57% of the width, 3:2, starts 40 px below the top of the cell, above the card
Card Right, 56% of the width, at least 400 px high (minH), paper.deep, with a bottom margin of 66 px that reserves the room for the control bar (22 px gap plus 44 px bar)
Card content Centred in the card; left padding of 25% of the slide width (a percentage padding on a grid item refers to the grid area, as in the canvas; it clears the 13% overlap with the photo) and 44 px on the right

The cell is therefore as high as the larger of "photo bottom" and "card plus the control room". The two overlap by about 13% of the width, as in the canvas.

Below lg

A wrapper at most 640 px wide, centred. The photo is full width of the wrapper, 4:3; the card follows with a negative top margin of 36 px so it overlaps the bottom of the photo, with 72 px top padding so the text starts below the overlap and 28 px at the sides. Text centred. The control bar is below the card (see Controls).

Photo

  • DeferredImage (keeps the lazy loading, the width and height that reserve space, and the noscript twin) with objectFit: cover, bg: paper.deep until it loads, and objectPosition from normalizeImagePosition(testimonial.imagePosition).
  • No FramedImage and no coloured block (BR-TR-06). The source files stay 880 x 1100.

Card text

Element Style
Shoot type Heading font, uppercase, letter-spacing 0.2em, 21 px (19 px below lg), colour ink
Quote chakra.blockquote, body font, weight 300, 17 px (16.5 px below lg), line-height 1.75, colour ink.soft, balanced wrapping (text-wrap: pretty)
Names chakra.figcaption, small caps style (textStyle="eyebrow"), colour accent.deeper; the old "— " prefix is dropped

figure > blockquote + figcaption stays (BR-REV-11). No decorative quotation mark. Plain elements are used instead of Chakra's Blockquote for the same bundle-size reason as before.

TestimonialCarousel (changed)

  • Chakra useCarousel with slideCount, loop, allowMouseDrag, translations.item = slideLabel, onPageChange for the announcement, and spacing set to 0 (slides come directly after each other, as on the canvas). The old 4 rem spacing existed so the sand block of one photo never peeked into the next slide; without that block it is not needed. Code Generation checks that the next slide never shows at the edge.
  • Carousel.ItemGroup keeps aria-live="off"; items stretch to equal height (BR-REV-07); no more ps and pb of 1.5 rem on the items.
  • Touch and mouse: the carousel follows the finger and snaps. Under reduced motion the buttons, keys and indicators call the API with instant; the swipe snap is made instant by the existing reduced-motion CSS.
  • Control bar (own markup, as before): previous button, counter, next button.
    • From lg: placed at the bottom right of the carousel, aligned with the card column (width 56%, left padding 25%, right 44 px), content centred; it sits in the room reserved under the card.
    • Below lg: below the slides, centred, 28 px under the card.
    • Buttons: icon only (the existing Ant Design arrows, offline), no circle and no border, 44 px target, lighter on hover (opacity), the theme focus ring on keyboard focus. Names "Vorige review" and "Volgende review". Arrow keys on the bar work as before.
    • Counter: Text with the heading font, 16 px, letter-spacing 0.08em, ink.soft, aria-hidden, content slideCounter(carousel.page, count).
    • The dots are removed.
  • Live region: unchanged: empty on load, slideLabel(page, count) after a change.
  • Test ids: testimonials-prev, testimonials-next, testimonials-status, new testimonials-counter; testimonials-dot-{n} is removed.

carouselControl recipe (changed)

The dot variant is removed. The arrow variant loses its 48 px box with border: it becomes a 44 px square target without border or background, with opacity transition (hover lowers the opacity to 0.55, which lightens it; keyboard focus gets the theme's focus ring and is not dimmed, because opacity would also fade the ring). The recipe comment names the buttons under the testimonials only.

CarouselPlaceholder (changed)

  • Shows the longest review as a normal TestimonialSlide (no padding wrappers any more), the other reviews visually hidden, aria-hidden and inert (BR-LZY-02).
  • Below lg it adds a spacer of the control bar's height plus its margin, with data-requires-js as before; from lg no spacer is needed, because the bar sits inside the room the slide already reserves.

Accessibility (NFR-TR-01)

  • The region is named by the h2; the carousel keeps its aria-roledescription and label; slides are named "Review n van m".
  • Contrast on paper.deep: names accent.deeper (about 6.4:1), quote ink.soft (about 6.1:1), shoot type ink (higher).
  • Targets of at least 44 px; the focus ring comes from the theme.
  • Hidden slides stay inert (BR-REV-10); the counter is hidden from assistive technology and never read twice.
  • Axe clean for the placeholder, the carousel and the single review.

Interaction flows

  • Visitor presses next, presses the right arrow key in the bar, or swipes left: the carousel moves one review forward, slides (or jumps under reduced motion), the counter changes to "2 / 2", the live region announces "Review 2 van 2".
  • On the last review, next goes to the first (loop); on the first, previous goes to the last.
  • No form, no API call and no persisted state in this unit.

Not in this unit

Autoplay and pause (removed), dots (removed), changes outside the Testimonials folder other than the theme-free helpers, content, test helpers and LAYOUT.md.