Component boundaries, interfaces, services and dependencies for the shell: footer, back-to-top, skip link, status pages, page intro, shared RouterLink, content folder and navigation module. Includes the answered design questions and the revised site content requirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
128 lines
7.1 KiB
Markdown
128 lines
7.1 KiB
Markdown
# Components — frontend-shell
|
|
|
|
Paths are relative to `web/src/`. Status: **new**, **changed**, **moved**, **unchanged**.
|
|
|
|
## Shell
|
|
|
|
### AppShell — `components/AppShell.tsx` (changed)
|
|
- **Purpose**: The frame around every page (LAYOUT.md "Shell": Header / Page content / Footer)
|
|
- **Responsibilities**: Renders, in order:
|
|
1. `SkipNavLink` "Direct naar de inhoud"
|
|
2. `NavigationBar`
|
|
3. `SkipNavContent as="main" id="main"` wrapping `<Outlet />`
|
|
4. `Footer` (receives `siteContent`)
|
|
5. `BackToTop`
|
|
- It is the single place where site-wide content enters the component tree (application design Q3 = A); later this becomes a loader or API call.
|
|
- **Interface**: no props
|
|
|
|
### NavigationBar — `components/NavigationBar/` (changed)
|
|
- **Purpose**: Fixed header with logo, desktop menu, hamburger and mobile menu
|
|
- **Changes**:
|
|
- The logo becomes a link home (`RouterLink to="/"`, accessible name "Andrea Slop Fotografie, naar de homepage").
|
|
- The menu reads `mainNav` from `navigation.ts`; `navItems.ts` is removed.
|
|
- `let` → `const`.
|
|
- **Unchanged**: overlay/solid behaviour, shrink on scroll, `MobileNav` (Escape, scroll lock), `NavLink` underline animation
|
|
- `NavLink` and `MobileNav` switch from their own `chakra(Link)` to the shared `RouterLink`.
|
|
|
|
### Footer — `components/Footer/Footer.tsx` (new, replaces `components/Footer.tsx`)
|
|
- **Purpose**: Site footer per design (FR-05)
|
|
- **Responsibilities**:
|
|
- **Top section**, as a `SimpleGrid` (1, 2 or 3 columns) with three columns:
|
|
- brand: `Image` of `logo-dark.png` plus the intro text
|
|
- "Socials": text links, names from `socialPlatforms`
|
|
- "Contact": a `mailto:` link
|
|
- **Bottom bar**: © current year plus the `nav aria-label="Footermenu"` with `footerNav`
|
|
- **Links**:
|
|
- all links are Chakra `Link variant="subtle"`; internal ones use `asChild` around `RouterLink`
|
|
- column headings use `eyebrow`
|
|
- external links open in a new tab with `rel="noopener noreferrer"`
|
|
- **Interface**: `content: SiteContent`
|
|
- **Sub-component**: `FooterColumn` (heading + list), local to the Footer folder
|
|
|
|
### BackToTop — `components/BackToTop/BackToTop.tsx` (new)
|
|
- **Purpose**: Fixed button bottom-right to scroll back up (FR-06)
|
|
- **Responsibilities**:
|
|
- **Visibility**: shown when scrolled past 60% of the viewport height (reuses `useScrolledPast` with a module-level threshold function).
|
|
- **Scrolling**: smooth, or instant under reduced motion.
|
|
- **Icon**: Ant Design `up-outlined` (offline).
|
|
- **While hidden**: not focusable, not announced, not clickable.
|
|
- **Interface**: no props
|
|
|
|
### Skip link and main landmark — Chakra `SkipNavLink` / `SkipNavContent` (built-in, restyled)
|
|
- **Purpose**: FR-07
|
|
- **Responsibilities**: Chakra provides the behaviour. The theme overrides the `skipNavLink` recipe to the design (ink background, white text, square corners).
|
|
- No own component.
|
|
|
|
## Pages and page building blocks
|
|
|
|
### PageIntro — `components/PageIntro/PageIntro.tsx` (new)
|
|
- **Purpose**: The top "Intro" block of a content page; placeholders use it now, real pages later (application design Q5 = A)
|
|
- **Responsibilities**: Offset below the fixed header (`pt="header"` plus spacing), `Container`, optional eyebrow, one `h1` (`Heading`), optional children (intro text)
|
|
- **Interface**: `title`, `eyebrow?`, `children?`
|
|
|
|
### StatusPage — `components/StatusPage/StatusPage.tsx` (new)
|
|
- **Purpose**: Shared layout for 404 and error pages (application design Q6 = A)
|
|
- **Responsibilities**: Header offset, centred `Container`, `h1`, short text, `LinkButton` to home
|
|
- **Interface**: `title`, `children` (message), `action?` (defaults to home)
|
|
|
|
### NotFound — `components/StatusPage/NotFound.tsx` (new)
|
|
- **Purpose**: FR-09. A thin wrapper around `StatusPage` with the Dutch 404 copy.
|
|
- **Head handling**: sets its own title and `robots: noindex` (mechanism detailed in Functional Design).
|
|
- **Wiring**: registered as the root route's `notFoundComponent`.
|
|
|
|
### ErrorPage — `components/StatusPage/ErrorPage.tsx` (new)
|
|
- **Purpose**: FR-10. A thin wrapper around `StatusPage` with a generic Dutch message.
|
|
- **Behaviour**: never renders error details. Logs the error with `console.error`; there is no central logging (SECURITY-03 N/A).
|
|
- **Wiring**: registered as the router's `defaultErrorComponent` and the root route's `errorComponent`.
|
|
|
|
### Routes — `routes/` (new and changed)
|
|
- **New**: `portfolio.tsx`, `soorten-fotoshoots.tsx`, `contact.tsx`, `privacyverklaring.tsx`. Each has `head: pageHead(...)` and a `PageIntro` placeholder.
|
|
- **Changed**:
|
|
- `over-mij.tsx`: `PageIntro` placeholder, Prettier style.
|
|
- `index.tsx`: passes `heroContent` and `siteContent.socials` to `Hero`.
|
|
- `__root.tsx`: registers `notFoundComponent` and `errorComponent`.
|
|
|
|
## Shared building blocks
|
|
|
|
### RouterLink — `components/RouterLink.tsx` (new)
|
|
- **Purpose**: The single router-aware Chakra link primitive (application design Q8 = A): `chakra(Link)` from TanStack Router
|
|
- **Used by**: `NavLink`, `MobileNav`, `LinkButton`, `NavigationBar` (logo), `Footer` (via `Link asChild`)
|
|
|
|
### LinkButton — `components/LinkButton.tsx` (changed)
|
|
- Uses `RouterLink` instead of its own `chakra(Link)`. Otherwise unchanged.
|
|
|
|
### Hero — `components/Hero/` (changed)
|
|
- **Changes**:
|
|
- `Hero` gets a separate `socials` prop; `HeroContent` no longer contains socials.
|
|
- `HeroArrows` and `HeroSocials` use the new `iconControl` recipe instead of repeating the opacity/hover styles (application design Q9 = A).
|
|
- `heroContent.ts`, `types.ts` and `socialPlatforms.ts` move to `content/`.
|
|
|
|
## Content and configuration modules
|
|
|
|
### content/ — `content/` (new folder; application design Q2 = A)
|
|
- `types.ts`: `SiteContent`, `SocialLink`, `HeroContent`, `HeroSlide`, `HeroCta` (moved from `Hero/types.ts`, without `socials` in `HeroContent`)
|
|
- `siteContent.ts`: static `SiteContent` (footer intro, socials, e-mail). Replaced by API data later.
|
|
- `heroContent.ts`: moved from `Hero/`
|
|
- `socialPlatforms.ts`: moved from `Hero/`. The platform registry (name + icon) is shared by Hero (icons) and Footer (names).
|
|
|
|
### navigation.ts — `navigation.ts` (new; replaces `NavigationBar/navItems.ts`; application design Q4 = A)
|
|
- **Purpose**: Menu structures that point at routes. They are code, not content.
|
|
- **Exports**:
|
|
- `mainNav`: Home, Over mij, Portfolio, Soorten fotoshoots, Contact
|
|
- `footerNav`: Portfolio, Soorten fotoshoots, Contact, Privacyverklaring
|
|
|
|
### theme.ts and recipes/ (changed)
|
|
- **Remove**: `globalCss.body.height: '250vh'`
|
|
- **Recipe overrides**, extending Chakra built-ins:
|
|
- `link` gets a new variant `subtle`: `ink.soft`, hover `accent.deep`, no underline, focus ring.
|
|
- `skipNavLink` is restyled to the design.
|
|
- **New recipe** `recipes/iconControl.ts`: icon-only controls over photos. Opacity 0.6 → 1 on hover/focus-visible, with the `interaction`/`smooth` tokens.
|
|
|
|
### main.tsx (changed)
|
|
- `createRouter({ routeTree, scrollRestoration: true, defaultErrorComponent: ErrorPage })`
|
|
|
|
### Build and config (changed; detailed in NFR Requirements)
|
|
- `vite.config.js`: security headers for `server` and `preview`, plus the Vitest config
|
|
- `package.json`: `test` script, new dev dependencies; `@vitejs/plugin-react` moves to dev dependencies
|
|
- Assets: delete `hero.png`, `typescript.svg`, `vite.svg`
|