Functional design, NFR requirements, code generation plan and summary, and build-and-test instructions with results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 KiB
10 KiB
Frontend Components — frontend-shell
Paths relative to web/src/. Builds on components.md; this file adds behaviour, state and final copy. Rule IDs refer to business-rules.md.
Component Hierarchy
graph TD
root["__root.tsx RootLayout"]
head["HeadContent"]
shell["AppShell"]
skip["SkipNavLink"]
nav["NavigationBar"]
navlink["NavLink"]
mobile["MobileNav"]
main["SkipNavContent as main"]
outlet["Outlet"]
pages["Route pages"]
intro["PageIntro"]
hero["Hero"]
notfound["NotFound"]
errorp["ErrorPage"]
status["StatusPage"]
footer["Footer"]
col["FooterColumn"]
top["BackToTop"]
rlink["RouterLink"]
lbtn["LinkButton"]
scrolled["useScrolledPast"]
root --> head
root --> shell
shell --> skip
shell --> nav
shell --> main
shell --> footer
shell --> top
nav --> navlink
nav --> mobile
main --> outlet
outlet --> pages
outlet --> notfound
outlet --> errorp
pages --> intro
pages --> hero
notfound --> status
errorp --> status
status --> lbtn
footer --> col
navlink --> rlink
mobile --> rlink
lbtn --> rlink
footer --> rlink
nav --> scrolled
top --> scrolled
classDef layout fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000;
classDef ui fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000;
classDef hook fill:#9C27B0,stroke:#4a148c,stroke-width:1px,color:#000;
classDef chakra fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000;
class root,shell,main,outlet layout;
class nav,navlink,mobile,pages,intro,hero,notfound,errorp,status,footer,col,top,lbtn ui;
class rlink,scrolled hook;
class head,skip chakra;
Text alternative: the root layout renders HeadContent and AppShell; AppShell holds the skip link, NavigationBar, main (with the routed page, NotFound or ErrorPage), Footer and BackToTop; NotFound and ErrorPage share StatusPage; all router links go through RouterLink and both NavigationBar and BackToTop use useScrolledPast (green = layout, blue = UI, purple = shared primitive/hook, orange = built-in).
Components
AppShell
- Props / state: none
- Renders:
SkipNavLink"Direct naar de inhoud" →NavigationBar→SkipNavContent as="main" id="main"with<Outlet />→Footer content={siteContent}→BackToTop - Hook:
useRouteFocus()(new,hooks/) subscribes to the router's resolved event and moves focus tomain#mainwhen the pathname changes, skipping the first load (BR-A11Y-01)
RootLayout (__root.tsx)
- Root
head:siteHead(site-wide Open Graph andtwitter:cardtags, defaultog:image) plus the JSON-LD script fromjsonLdScript(professionalService(siteContent))(BR-SEO-04, -05)
Route heads
- Each route calls
pageHead('/portfolio')etc.pageHeadlooks up thesitePagesentry and returns title, description, canonical link,og:url,og:title,og:description,og:imageand, forindexed: false,robots: noindex(BR-SEO-01 to -04)
Footer (+ local FooterColumn)
- Props:
content: SiteContent. State: none. - Derived:
socials = visibleSocials(content.socials),email = emailAddress(content.email),year = new Date().getFullYear() - Top section (
SimpleGrid, 1 / 2 / 3 columns):- Brand:
logo-dark.png(alt "Andrea Slop Fotografie") +footerIntrowith its line breaks kept. Mobile: logo 150px and text centred, stacked. Tablet and desktop: logo 110px with the text beside it, vertically centred (footer review) - "Socials": text links with the platform name plus visually hidden " (opent in nieuw tabblad)"; omitted when empty (BR-FOOT-01, BR-A11Y-03)
- "Contact":
mailto:link with the address as text; omitted whenemailisnull - Column headings are
h2withtextStyle="eyebrow"(BR-SEO-09); the logo haswidth/heightandloading="lazy"(BR-SEO-10)
- Brand:
- Bottom bar:
copyrightLine(year)+nav aria-label="Footermenu"withfooterNav. Stacked and centred on mobile. - Links:
Link variant="subtle"; internal viaasChild+RouterLink(aria-currentwithout visual change, BR-FOOT-03)
BackToTop
- Props: none. State:
visiblefromuseScrolledPast(threshold);thresholdis a module-level function() => backToTopThreshold(window.innerHeight). - Renders:
chakra.buttonwitharia-label="Terug naar boven"and theup-outlinedicon (aria-hidden) - Behaviour: BR-TOP-01…09. Click handler:
reduced = matchMedia('(prefers-reduced-motion: reduce)').matcheswindow.scrollTo({ top: 0, behavior: reduced ? 'instant' : 'smooth' })document.getElementById('main')?.focus({ preventScroll: true })
PageIntro
- Props:
title,eyebrow?,children? - Renders:
pt="pageTop",Container, eyebrow (textStyle="eyebrow"), oneh1(textStyle="pageTitle"), children
StatusPage
- Props:
title,children(message),actions?: ReactNode. Defaults to oneLinkButton to="/""Terug naar home". - Refinement of the Application Design:
action?: { label, to }becomesactions?: ReactNode, because the error page needs abuttonnext to a link (BR-ERR-04). - Renders:
pt="pageTop", centredContainer, oneh1(textStyle="pageTitle"), text, action row
NotFound
- Renders
<title>+<meta name="robots" content="noindex">(BR-404-02) andStatusPage
ErrorPage
- Props:
ErrorComponentProps(error,reset).erroris used only for logging. useEffect(() => console.error(error), [error])(BR-ERR-03)- Renders
<title>+noindex(BR-ERR-05) andStatusPagewith two actions:- "Opnieuw proberen":
chakra.buttonwith thelinkButtonrecipe, variantaccent. On click:reset()androuter.invalidate() - "Terug naar home":
LinkButton variant="outline"
- "Opnieuw proberen":
NavigationBar, NavLink, MobileNav
- Menu from
mainNav. Logo wrapped inRouterLink to="/"witharia-label="Andrea Slop Fotografie, naar de homepage". Otherwise unchanged.
Hero, HeroSocials, HeroArrows
Heropropscontent: HeroContentandsocials: SocialLink[].HeroSocialsrendersvisibleSocials(socials)witharia-label"{name} (opent in nieuw tabblad)". Both icon controls use theiconControlrecipe, which also turns the focus ring white on photos.- The first slide loads eagerly with
fetchpriority="high", the others lazily (BR-SEO-10).
Responsive Behaviour (BR-RWD-01 to -05)
| Component | base (< 768) | md (768–1023) | lg (≥ 1024) | Ultrawide |
|---|---|---|---|---|
| NavigationBar | 66px, hamburger + mobile menu, always solid | same as base | 92px → 68px after scrolling, inline menu, transparent over the hero | content width centred |
| Footer top | 1 column | 2 equal columns; the third wraps to a new row | 3 columns, 1.2fr 1fr 1fr |
content width centred |
| Footer bottom bar | stacked, centred | one row: © left, menu right | same as md | content width centred |
| PageIntro / StatusPage | gutter side margin, title size pageTitle base |
larger pageTitle |
largest pageTitle |
content width centred |
| BackToTop | 46px, design offset, 44px+ target | same | same | aligned to the content edge (BR-TOP-08) |
| Hero | full-screen photo, controls 44px+ | same | same | photo fills the width, text in the content width |
Every column: no horizontal scroll from 320px; works at 200% zoom.
Theme Usage (BR-THEME-01 to -07)
| Shared piece | Kind | Status | Used by |
|---|---|---|---|
paper, ink, ink.soft, line, accent.deep |
colour tokens | existing | all |
focusRing |
semantic colour token + global :focus-visible |
new | every focusable element |
gutter, header |
spacing tokens | existing | NavigationBar, Footer, PageIntro, StatusPage |
pageTop |
spacing token | new | PageIntro, StatusPage |
content |
size token | new | Container recipe, BackToTop |
header, mobileNav, menuToggle, backToTop |
z-index tokens | new | NavigationBar, MobileNav, BackToTop |
interaction, smooth |
duration/easing | existing | all transitions |
eyebrow |
text style | existing | footer headings, PageIntro eyebrow, buttons |
pageTitle |
text style | new | PageIntro, StatusPage |
linkButton |
recipe | existing | LinkButton, ErrorPage retry button |
link variant subtle |
recipe variant | new | Footer |
iconControl |
recipe | new | HeroArrows, HeroSocials |
skipNavLink |
recipe override | new | SkipNavLink |
RouterLink |
shared primitive | new | NavLink, MobileNav, LinkButton, logo, Footer |
Copy
Placeholder pages (Q8 = A)
Every placeholder uses PageIntro with the line "Deze pagina is nog in de maak. Kom snel terug!"
| Route | Eyebrow | h1 |
|---|---|---|
/over-mij |
Andrea Slop Fotografie | Over mij |
/portfolio |
Werk | Portfolio |
/soorten-fotoshoots |
Mogelijkheden | Soorten fotoshoots |
/contact |
Neem contact op | Contact |
/privacyverklaring |
Privacy | Privacyverklaring |
Status pages
| Page | h1 |
Text | Actions |
|---|---|---|---|
| 404 (Q9 = A) | Pagina niet gevonden | Deze pagina bestaat niet (meer). Misschien is de link verouderd of zit er een typfout in het adres. | Terug naar home |
| Error (Q10 = B) | Er ging iets mis | Door een fout kan deze pagina nu niet worden getoond. Probeer het opnieuw of ga terug naar de homepage. | Opnieuw proberen, Terug naar home |
User Interaction Flows
- Keyboard, first Tab: skip link appears → Enter → focus in
main#main - Back to top: scroll down → button appears → click/Enter → page scrolls up, focus in
main, button hides - Page change: click a menu link → new page at the top, focus in
main, screen reader reads the new content - Unknown URL: shell + 404 → "Terug naar home"
- Page error: shell + error page → "Opnieuw proberen" re-renders the route, or "Terug naar home"
Forms and API Integration
- Forms: none in the shell. The contact form is a later feature (see business-logic-model.md, Recommendations).
- API: none yet.
siteContentandheroContentare static modules shaped like the future CMS responses.