Files
SlpSoftware/aidlc-docs/features/redesign-modern-timetravel/construction/packages-block/functional-design/frontend-components.md
T
SluijsensandClaude Sonnet 5.5 9661b64635 Pakketblok: elk aantal pakketten, filterchips, swipe-rij op mobiel en optionele banner
Pure logica (splitsen, chips, filter, labels), useSwipeRow en usePackageFilter,
ContactPreselect voor het formulier, kaarten in stijl B en tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 10:34:09 +01:00

3.5 KiB

Frontend Components — packages-block (U3)

Component hierarchy

graph TD
    pg[LandingPage] --> ps[PackagesSection]
    ps --> hd[SectionHeading]
    ps --> fc[FilterChips]
    ps --> st[ResultStatus]
    ps --> sk[PackageSkeletons]
    ps --> er[PackagesError]
    ps --> em[PackagesEmpty]
    ps --> pl[PackageList]
    pl --> sr[SwipeRow]
    pl --> pc[PackageCard]
    sr --> dt[SwipeDots]
    ps --> bn[PackageBanner]
    ps -.uses.-> q[usePackagesQuery]
    ps -.uses.-> f[usePackageFilter]
    sr -.uses.-> sw[useSwipeRow]
    pc -.uses.-> pre[useContactPreselect]
    bn -.uses.-> pre
    classDef page fill:#2196F3,stroke:#0d47a1,color:#000;
    classDef ui fill:#4CAF50,stroke:#2e7d32,color:#000;
    classDef hook fill:#9C27B0,stroke:#4a148c,color:#000;
    class pg,ps page;
    class hd,fc,st,sk,er,em,pl,sr,dt,pc,bn ui;
    class q,f,sw,pre hook;

Text alternative: the packages section shows a heading, optional filter chips, a status line, then skeletons, an error, an empty note or the package list (grid or swipe row with dots) and an optional banner; hooks provide data, filtering, swipe state and the contact preselect.

Components

Component Props / state
PackagesSection none; data from usePackagesQuery, settings from content.ts; renders #pakketten as <section aria-labelledby> on bg-surface (alt colour)
FilterChips chips, activeId, onSelect; role="group" aria-label="Filter pakketten"; square chips, active = ink background
ResultStatus label; aria-live="polite"
PackageList packages, featuredIndex; grid on sm+, SwipeRow below (same cards rendered once, layout switched by CSS: flex snap-x below sm, grid above)
SwipeDots count, activeIndex, titles, onSelect; sm:hidden
PackageCard pkg; featured styling; CTA link #contact with onClick select + scroll; data-testid=package-card-{id}
PackageBanner pkg or fallback; black block; CTA like the card
PackageSkeletons, PackagesError (retry), PackagesEmpty as BR-U3-10

User interaction flows

  • Chip click → filter, row resets, status line announces the new count.
  • Swipe/scroll → active dot follows; dot click → smooth scroll to the card.
  • "Kies …" → preselect + scroll to #contact.

Form validation rules

None.

API integration points

GET /api/v1/offerings via the existing usePackagesQuery (type gains category?).

Acceptance tests

  1. 3 packages, empty bannerSlugs: 3 cards, no chips, no banner, Maatwerk is a card.
  2. 6 packages with 2 categories: chips "Alles (6)", categories with counts; selecting filters; packages without category only under "Alles"; threshold boundary 3 vs 4.
  3. bannerSlugs=['maatwerk']: that package is rendered as the banner, not as a card, and stays visible when a chip is active; fallback banner when the slug does not match.
  4. Result label singular/plural and announcement on change.
  5. Swipe row: scroll container has snap classes, group role and label; initial scroll position at the featured card; dots count/labels/aria-current; dot click scrolls; scroll updates the active dot (jsdom with mocked offsets); reduced motion → non-smooth.
  6. CTA sets preselect (slug, key increments) and anchors to #contact.
  7. Loading skeletons, error with retry (refetch called), empty state.
  8. Pure functions table-driven (split, chips, filter, label, initialIndex, activeIndexFromScroll).
  9. Accessibility: chips aria-pressed, cards h3, touch target classes, landmark label.