# Frontend Components — frontend-shell
Paths relative to `web/src/`. Builds on [components.md](../../../inception/application-design/components.md); this file adds behaviour, state and final copy. Rule IDs refer to [business-rules.md](business-rules.md).
## Component Hierarchy
```mermaid
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 `` → `Footer content={siteContent}` → `BackToTop`
- **Hook**: `useRouteFocus()` (new, `hooks/`) subscribes to the router's resolved event and moves focus to `main#main` when the pathname changes, skipping the first load (BR-A11Y-01)
### RootLayout (`__root.tsx`)
- Root `head`: `siteHead` (site-wide Open Graph and `twitter:card` tags, default `og:image`) plus the JSON-LD script from `jsonLdScript(professionalService(siteContent))` (BR-SEO-04, -05)
### Route heads
- Each route calls `pageHead('/portfolio')` etc. `pageHead` looks up the `sitePages` entry and returns title, description, canonical link, `og:url`, `og:title`, `og:description`, `og:image` and, for `indexed: 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") + `footerIntro` with 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 when `email` is `null`
- Column headings are `h2` with `textStyle="eyebrow"` (BR-SEO-09); the logo has `width`/`height` and `loading="lazy"` (BR-SEO-10)
- **Bottom bar**: `copyrightLine(year)` + `nav aria-label="Footermenu"` with `footerNav`. Stacked and centred on mobile.
- **Links**: `Link variant="subtle"`; internal via `asChild` + `RouterLink` (`aria-current` without visual change, BR-FOOT-03)
### BackToTop
- **Props**: none. **State**: `visible` from `useScrolledPast(threshold)`; `threshold` is a module-level function `() => backToTopThreshold(window.innerHeight)`.
- **Renders**: `chakra.button` with `aria-label="Terug naar boven"` and the `up-outlined` icon (`aria-hidden`)
- **Behaviour**: BR-TOP-01…09. Click handler:
1. `reduced = matchMedia('(prefers-reduced-motion: reduce)').matches`
2. `window.scrollTo({ top: 0, behavior: reduced ? 'instant' : 'smooth' })`
3. `document.getElementById('main')?.focus({ preventScroll: true })`
### PageIntro
- **Props**: `title`, `eyebrow?`, `children?`
- **Renders**: `pt="pageTop"`, `Container`, eyebrow (`textStyle="eyebrow"`), one `h1` (`textStyle="pageTitle"`), children
### StatusPage
- **Props**: `title`, `children` (message), `actions?: ReactNode`. Defaults to one `LinkButton to="/"` "Terug naar home".
- **Refinement of the Application Design**: `action?: { label, to }` becomes `actions?: ReactNode`, because the error page needs a `button` next to a link (BR-ERR-04).
- **Renders**: `pt="pageTop"`, centred `Container`, one `h1` (`textStyle="pageTitle"`), text, action row
### NotFound
- Renders `
` + `` (BR-404-02) and `StatusPage`
### ErrorPage
- **Props**: `ErrorComponentProps` (`error`, `reset`). `error` is used only for logging.
- `useEffect(() => console.error(error), [error])` (BR-ERR-03)
- Renders `` + `noindex` (BR-ERR-05) and `StatusPage` with two actions:
- "Opnieuw proberen": `chakra.button` with the `linkButton` recipe, variant `accent`. On click: `reset()` and `router.invalidate()`
- "Terug naar home": `LinkButton variant="outline"`
### NavigationBar, NavLink, MobileNav
- Menu from `mainNav`. Logo wrapped in `RouterLink to="/"` with `aria-label="Andrea Slop Fotografie, naar de homepage"`. Otherwise unchanged.
### Hero, HeroSocials, HeroArrows
- `Hero` props `content: HeroContent` and `socials: SocialLink[]`. `HeroSocials` renders `visibleSocials(socials)` with `aria-label` "{name} (opent in nieuw tabblad)". Both icon controls use the `iconControl` recipe, 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. `siteContent` and `heroContent` are static modules shaped like the future CMS responses.