# Frontend Components — Unit 4: Lieve woorden ## Hierarchy ```mermaid graph TD Route["routes/index.tsx"] --> T["home/Testimonials"] T --> Section["HomeSection tone alt"] T --> Heading["SectionHeading"] T --> Root["Carousel.Root loop"] Root --> Group["Carousel.ItemGroup"] Group --> Item["Carousel.Item x n"] Item --> Slide["home/Testimonials/TestimonialSlide"] Slide --> Framed["FramedImage 4 by 5"] Root --> Control["Carousel.Control: Prev, Indicators, Next"] T --> Live["Live region"] Lib["lib: visibleTestimonials, slideLabel"] -.-> T 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,Root,Group,Item,Slide,Framed,Control,Live ui; class Lib logic; ``` Text alternative: the home route renders Testimonials, which uses HomeSection, SectionHeading, a looping Chakra Carousel with one item per review (each a TestimonialSlide with a FramedImage) and a control bar with previous, dots and next, plus a live region; pure helpers supply the shown reviews and labels. ## Testimonials - **Props**: `{ content: HomeContent['testimonials']; testimonials: Testimonial[] }` - **Behaviour**: `visibleTestimonials`; none → `null`; one → the `TestimonialSlide` directly (no carousel); two or more → `Carousel.Root` with `slideCount`, `loop`, `allowMouseDrag`, one slide per page. - **Layout**: `HomeSection` with `tone="alt"`, `data-testid="testimonials"`, centred `SectionHeading`. Controls centred below the slides, margin `clamp(2.5rem, 5vw, 4rem)`. - **Equal height** (BR-REV-07): items stretch in the item group's row, so all slides take the tallest height; content vertically centred within. - **Reduced motion** (BR-REV-06): the item group's scrolling is instant (`scroll-behavior: auto`). - **Announcements** (BR-REV-08): a `VisuallyHidden` polite live region, empty on load, set to `slideLabel(page, count)` in `onPageChange`. Any live region Chakra adds itself is checked so only one announcement is made. - **Controls**: `Carousel.PrevTrigger` / `NextTrigger` with Dutch `aria-label`s and arrow icons from the offline icon set (as the hero), 48 px square, `line` border, `ink` border on hover/focus; `Carousel.Indicator` per page, 44 px hit area around an 8 px dot (`accent.deep` outline, filled when current). - **Test ids**: `testimonials`, `testimonials-prev`, `testimonials-next`, `testimonials-dot-{n}`, `testimonial-{id}`. ## TestimonialSlide - **Props**: `{ testimonial: Testimonial }` - **Layout**: grid `5fr 11fr` from `lg` (photo column ±75% of the design's `5fr 7fr`) with gap `clamp(2rem, 6vw, 5.5rem)`, centred vertically; stacked below `lg` with the photo centred, max 180 px wide on phones and 320 px on tablets, content aligned to the top (slides share the tallest height) and a 1.25 rem gap between photo and text (owner's choices after review). - **Photo**: `FramedImage` with aspect `4 / 5` (the source photos are cropped to 4:5 when prepared). - **Text**: decorative quotation mark (Marcellus, `clamp(5rem, 9vw, 7.5rem)`, `accent`, `aria-hidden`); shoot as eyebrow (`accent.deep`); `figure` > `Blockquote` (Marcellus, `clamp(1.35rem, 2.2vw, 1.75rem)`, line-height 1.5, `ink`) > `figcaption` with "— " + author in small caps (`ink.soft`). ## Accessibility (NFR-HP-01) - Region named by the h2 "Lieve woorden"; the carousel has `aria-roledescription` "carrousel" and a label "Reviews"; slides "Review n van m" (BR-REV-09). - Hidden slides are inert to keyboard and screen readers (BR-REV-10). - Focus ring from the theme on all controls; targets ≥ 44 px. - Axe clean; Lighthouse accessibility stays 1.0.