Adds application design for the front-end shell feature
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>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
# Application Design — frontend-shell (consolidated)
|
||||
|
||||
Detail documents: [components.md](components.md) · [component-methods.md](component-methods.md) · [services.md](services.md) · [component-dependency.md](component-dependency.md)
|
||||
|
||||
## Overview
|
||||
The shell stays the three-part frame from LAYOUT.md, now with full accessibility plumbing:
|
||||
- **Header**: `NavigationBar`
|
||||
- **Page content**: `main#main`
|
||||
- **Footer**: `Footer`
|
||||
|
||||
Around these sit a Chakra skip link and a `BackToTop` button. Pages are routed through TanStack Router. Unknown URLs and page errors render inside the shell. Site-wide content comes from a new `content/` folder and is passed down as props from two provisioning points. Menus are typed route lists in `navigation.ts`. Styling reuses the existing theme and extends Chakra's own recipes where styles repeat.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
Skip["SkipNavLink"] --> Header["NavigationBar (logo link, mainNav)"]
|
||||
Header --> Main["main#main: Outlet / NotFound / ErrorPage"]
|
||||
Main --> Foot["Footer (SiteContent, footerNav)"]
|
||||
Foot --> Top["BackToTop (fixed)"]
|
||||
classDef chrome fill:#e76f51,stroke:#ad533d,stroke-width:1px,color:#000;
|
||||
classDef content fill:#ffffff,stroke:#333333,stroke-width:1px,color:#000;
|
||||
classDef footer fill:#f4a261,stroke:#b77a49,stroke-width:1px,color:#000;
|
||||
class Skip,Header chrome;
|
||||
class Main content;
|
||||
class Foot,Top footer;
|
||||
```
|
||||
|
||||
Text alternative: top-to-bottom order of the shell: skip link, header, main content (page, 404 or error page), footer, and the fixed back-to-top button.
|
||||
|
||||
## Design Decisions
|
||||
| # | Decision | Source |
|
||||
|---|---|---|
|
||||
| D1 | One folder per component (`Footer/`, `BackToTop/`, `PageIntro/`, `StatusPage/`); `AppShell.tsx` stays | AD Q1 = A |
|
||||
| D2 | New `content/` folder: `siteContent`, `heroContent`, content types, `socialPlatforms` | AD Q2 = A |
|
||||
| D3 | Content enters via props from `AppShell` and the home route; components never import content | AD Q3 = A |
|
||||
| D4 | Menus are code: `navigation.ts` with `mainNav` + `footerNav`, typed on routes; FR-04 revised | AD Q4 = A |
|
||||
| D5 | `PageIntro` as reusable top block for content pages (placeholders now, real pages later) | AD Q5 = A |
|
||||
| D6 | `StatusPage` shared by `NotFound` and `ErrorPage` | AD Q6 = A |
|
||||
| D7 | Footer links via Chakra's built-in `Link` with a new `subtle` variant; router links via `asChild` | AD Q7 = A |
|
||||
| D8 | One shared `RouterLink = chakra(Link)`; `NavLink`, `MobileNav`, `LinkButton` refactored onto it | AD Q8 = A |
|
||||
| D9 | Hover-opacity pattern centralised as recipe `iconControl`; `HeroArrows` and `HeroSocials` use it | AD Q9 = A |
|
||||
| D10 | Skip link + main via Chakra `SkipNavLink`/`SkipNavContent`, restyled through the theme | NFR-02 |
|
||||
| D11 | `BackToTop` reuses `useScrolledPast`; pure helpers (`backToTopThreshold`, `visibleSocials`, `copyrightLine`) for PBT | NFR-02, NFR-03 |
|
||||
| D12 | Router: `scrollRestoration`, root `notFoundComponent`, `defaultErrorComponent` + root `errorComponent` | FR-08…FR-10 |
|
||||
|
||||
## Requirements Traceability
|
||||
| Requirement | Realised by |
|
||||
|---|---|
|
||||
| FR-01 Placeholder routes | `routes/{portfolio,soorten-fotoshoots,contact,privacyverklaring}.tsx` + `PageIntro` |
|
||||
| FR-02 Navigation items | `navigation.ts` `mainNav` → `NavigationBar`, `MobileNav` |
|
||||
| FR-03 Logo link | `NavigationBar` logo wrapped in `RouterLink to="/"` |
|
||||
| FR-04 Site content | `content/siteContent.ts`, `content/types.ts`; menus in `navigation.ts` (D4) |
|
||||
| FR-05 Footer | `Footer`, `FooterColumn`, `footerNav`, `link` `subtle` variant, `logo-dark.png` |
|
||||
| FR-06 Back to top | `BackToTop`, `useScrolledPast`, `backToTopThreshold` |
|
||||
| FR-07 Skip link + main | `SkipNavLink`/`SkipNavContent` in `AppShell`, `skipNavLink` recipe override |
|
||||
| FR-08 Scroll restoration | `createRouter({ scrollRestoration: true })` |
|
||||
| FR-09 404 | `NotFound` → `StatusPage`, root `notFoundComponent` |
|
||||
| FR-10 Error page | `ErrorPage` → `StatusPage`, `defaultErrorComponent` + root `errorComponent` |
|
||||
| FR-11 Tech debt | `theme.ts` (250vh), `over-mij.tsx`, `NavigationBar` (`const`), assets, `package.json` |
|
||||
| NFR-01 Accessibility | Landmarks, skip link, `subtle` link contrast (`ink.soft`/`accent.deep`), hidden-state of BackToTop |
|
||||
| NFR-02 Reuse/Chakra | D7–D11 |
|
||||
| NFR-03 Testing | Pure helpers (D11) + component tests; toolchain in NFR Requirements |
|
||||
| NFR-04 Security | `rel="noopener noreferrer"` on external links; generic `ErrorPage`; headers in NFR Requirements |
|
||||
|
||||
## Open Points for Functional Design
|
||||
- **404 title and `noindex`**: a global not-found has no route `head` of its own. Choose between React 19 metadata hoisting (`<title>`/`<meta>` rendered inside `NotFound`) and a root `head` that reacts to the not-found state. Verify there is no duplicate `<title>` with `HeadContent`.
|
||||
- **BackToTop focus**: after "scroll to top", decide whether focus moves to the skip target (`main`) or stays on the button. The button is hidden at the top, so a focus decision is needed.
|
||||
- **Behaviour rules and testable properties** (PBT-01) for `backToTopThreshold`, `visibleSocials`, `copyrightLine` and the `mainNav`/`footerNav` invariants.
|
||||
|
||||
## Compliance Summary (Application Design)
|
||||
**Security Baseline**
|
||||
- SECURITY-09/15: compliant by design (generic `ErrorPage`; root error boundary as global handler).
|
||||
- SECURITY-13: compliant (no external resources).
|
||||
- SECURITY-04/10: addressed in NFR Requirements.
|
||||
- Others: N/A (see requirements.md).
|
||||
|
||||
**Property-Based Testing**
|
||||
- PBT-01: candidate pure functions identified (D11). Property identification is completed in Functional Design.
|
||||
- Other PBT rules: N/A at this stage.
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
# Component Dependencies — frontend-shell
|
||||
|
||||
## Dependency Graph
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
main_tsx["main.tsx"] --> router_cfg["createRouter (scrollRestoration, defaultErrorComponent)"]
|
||||
router_cfg --> root_route["routes/__root.tsx"]
|
||||
root_route --> AppShell["AppShell"]
|
||||
root_route --> NotFound["NotFound"]
|
||||
root_route --> ErrorPage["ErrorPage"]
|
||||
AppShell --> SkipNav["Chakra SkipNavLink / SkipNavContent"]
|
||||
AppShell --> NavigationBar["NavigationBar"]
|
||||
AppShell --> Footer["Footer"]
|
||||
AppShell --> BackToTop["BackToTop"]
|
||||
AppShell --> siteContent["content/siteContent"]
|
||||
NavigationBar --> navigation["navigation.ts"]
|
||||
Footer --> navigation
|
||||
NavigationBar --> RouterLink["RouterLink"]
|
||||
Footer --> RouterLink
|
||||
Footer --> socialPlatforms["content/socialPlatforms"]
|
||||
NotFound --> StatusPage["StatusPage"]
|
||||
ErrorPage --> StatusPage
|
||||
StatusPage --> LinkButton["LinkButton"]
|
||||
LinkButton --> RouterLink
|
||||
BackToTop --> useScrolledPast["useScrolledPast"]
|
||||
NavigationBar --> useScrolledPast
|
||||
pages["routes: portfolio, soorten-fotoshoots, contact, privacyverklaring, over-mij"] --> PageIntro["PageIntro"]
|
||||
index_route["routes/index.tsx"] --> Hero["Hero"]
|
||||
index_route --> heroContent["content/heroContent"]
|
||||
index_route --> siteContent
|
||||
Hero --> socialPlatforms
|
||||
Hero --> iconControl["recipe iconControl"]
|
||||
classDef entry fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
|
||||
classDef comp fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
|
||||
classDef data fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
|
||||
classDef shared fill:#e2e8f0,stroke:#4a5568,stroke-width:1px,color:#000;
|
||||
class main_tsx,router_cfg,root_route,index_route,pages entry;
|
||||
class AppShell,NotFound,ErrorPage,NavigationBar,Footer,BackToTop,StatusPage,PageIntro,Hero comp;
|
||||
class siteContent,heroContent,navigation,socialPlatforms data;
|
||||
class SkipNav,RouterLink,LinkButton,useScrolledPast,iconControl shared;
|
||||
```
|
||||
|
||||
Text alternative: main.tsx configures the router, which renders the root route (AppShell, NotFound, ErrorPage). AppShell composes the Chakra skip link, NavigationBar, Footer and BackToTop and feeds siteContent to the Footer. Navigation menus come from navigation.ts, links go through RouterLink, the status pages share StatusPage, and content pages share PageIntro. Colours: yellow = entry/routes, blue = components, green = data modules, grey = shared primitives.
|
||||
|
||||
## Dependency Matrix
|
||||
|
||||
| Component | Depends on |
|
||||
|---|---|
|
||||
| AppShell | NavigationBar, Footer, BackToTop, Chakra SkipNav*, siteContent |
|
||||
| NavigationBar | navigation (mainNav), RouterLink, NavLink, MobileNav, useScrolledPast, logo assets |
|
||||
| Footer | SiteContent type, navigation (footerNav), RouterLink, Chakra Link (`subtle`), socialPlatforms, visibleSocials, copyrightLine, logo-dark.png |
|
||||
| BackToTop | useScrolledPast, backToTopThreshold, Iconify `up-outlined` |
|
||||
| StatusPage | LinkButton, Container/Heading/Text |
|
||||
| NotFound / ErrorPage | StatusPage |
|
||||
| PageIntro | Container, Heading, `header` spacing token |
|
||||
| Hero | HeroContent, SocialLink, HeroArrows, HeroSocials, LinkButton, useHeroSlider |
|
||||
| HeroArrows / HeroSocials | `iconControl` recipe; HeroSocials also socialPlatforms, visibleSocials |
|
||||
| LinkButton / NavLink / MobileNav | RouterLink |
|
||||
|
||||
No circular dependencies. Content modules depend only on types and assets; components never import content (except the two provisioning points: `AppShell` and `routes/index.tsx`).
|
||||
|
||||
## Data Flow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
box rgba(246,224,94,0.4) Data
|
||||
participant C as content modules
|
||||
end
|
||||
box rgba(99,179,237,0.4) Shell
|
||||
participant S as AppShell
|
||||
participant F as Footer
|
||||
end
|
||||
box rgba(154,230,180,0.4) Page
|
||||
participant R as Home route
|
||||
participant H as Hero
|
||||
end
|
||||
S->>C: import siteContent
|
||||
S->>F: props content
|
||||
R->>C: import heroContent and siteContent
|
||||
R->>H: props content and socials
|
||||
```
|
||||
|
||||
Text alternative: AppShell reads siteContent and passes it to Footer as props; the home route reads heroContent and siteContent and passes them to Hero as props.
|
||||
|
||||
## Communication Patterns
|
||||
- **Props down only**: no context or global state is added.
|
||||
- **Routing state**: via TanStack Router hooks (`useRouterState`) inside `NavigationBar` only (existing).
|
||||
- **Scroll state**: a local hook per consumer (`useScrolledPast`), no shared store.
|
||||
@@ -0,0 +1,79 @@
|
||||
# Component Methods and Interfaces — frontend-shell
|
||||
|
||||
Signatures are TypeScript sketches; exact typing is settled in Code Generation. Behaviour rules (thresholds, copy, edge cases) are detailed in Functional Design.
|
||||
|
||||
## Content types — `content/types.ts`
|
||||
|
||||
```ts
|
||||
import type { SocialPlatform } from './socialPlatforms';
|
||||
|
||||
export interface SocialLink {
|
||||
platform: SocialPlatform;
|
||||
href: string; // leeg = niet tonen
|
||||
}
|
||||
|
||||
export interface SiteContent {
|
||||
footerIntro: string;
|
||||
socials: SocialLink[];
|
||||
email: string;
|
||||
}
|
||||
|
||||
export interface HeroSlide { id: string; src: string; alt: string }
|
||||
export interface HeroCta { label: string; to: string }
|
||||
export interface HeroContent {
|
||||
title: string;
|
||||
tagline: string;
|
||||
cta: HeroCta;
|
||||
slides: HeroSlide[];
|
||||
// socials verhuist naar SiteContent
|
||||
}
|
||||
```
|
||||
|
||||
## Navigation — `navigation.ts`
|
||||
|
||||
```ts
|
||||
// Typed on registered routes, so a typo in `to` is a type error
|
||||
type NavItem = { to: '/' | '/over-mij' | ...; label: string };
|
||||
|
||||
export const mainNav: readonly NavItem[];
|
||||
export const footerNav: readonly NavItem[];
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
| Component | Props | Notes |
|
||||
|---|---|---|
|
||||
| `AppShell` | none | Composes SkipNavLink, NavigationBar, main, Footer, BackToTop |
|
||||
| `NavigationBar` | none | Reads `mainNav`; logo `RouterLink to="/"` |
|
||||
| `NavLink` | `ComponentProps<typeof RouterLink>` | Unchanged API |
|
||||
| `MobileNav` | `{ id: string; open: boolean; onClose: () => void }` | Unchanged API |
|
||||
| `Footer` | `{ content: SiteContent }` | |
|
||||
| `FooterColumn` (local) | `{ title: string; children: ReactNode }` | Eyebrow heading + vertical list |
|
||||
| `BackToTop` | none | |
|
||||
| `PageIntro` | `{ title: string; eyebrow?: string; children?: ReactNode }` | Exactly one `h1` |
|
||||
| `StatusPage` | `{ title: string; children: ReactNode; action?: { label: string; to: string } }` | Default action: "Terug naar home" → `/` |
|
||||
| `NotFound` | `NotFoundRouteProps` (ignored) | Router `notFoundComponent` |
|
||||
| `ErrorPage` | `ErrorComponentProps` (`error`, `reset`) | Never renders `error`; logs it |
|
||||
| `Hero` | `{ content: HeroContent; socials: SocialLink[] }` | `socials` split off |
|
||||
| `HeroSocials` | `{ socials: SocialLink[] }` | Type renamed from `HeroSocial` |
|
||||
| `HeroArrows` | `{ onPrev: () => void; onNext: () => void }` | Unchanged API |
|
||||
| `LinkButton` | `ComponentProps<typeof RouterLink> & RecipeVariantProps<linkButton>` | Unchanged API |
|
||||
| `RouterLink` | `ComponentProps<typeof chakra(Link)>` | `export const RouterLink = chakra(Link)` |
|
||||
|
||||
## Hooks and helpers
|
||||
|
||||
| Name | Signature | Purpose |
|
||||
|---|---|---|
|
||||
| `useScrolledPast` (existing) | `(getThreshold: () => number) => boolean` | Reused by BackToTop; threshold function defined at module level so it is referentially stable |
|
||||
| `backToTopThreshold` (new, pure) | `(viewportHeight: number) => number` | 60% of viewport height; pure for property-based testing |
|
||||
| `visibleSocials` (new, pure) | `(socials: SocialLink[]) => SocialLink[]` | Drops entries with empty `href`; shared by HeroSocials and Footer (today's filter in HeroSocials is lifted out) |
|
||||
| `copyrightLine` (new, pure) | `(year: number) => string` | `"© {year} Andrea Slop Fotografie"` |
|
||||
| `pageHead` (existing) | `({ title, description }) => HeadOption` | Used by the new routes |
|
||||
|
||||
## Theme additions
|
||||
|
||||
| Key | Kind | Definition (summary) |
|
||||
|---|---|---|
|
||||
| `link.variants.variant.subtle` | Recipe variant (extends Chakra built-in `link`) | `color: ink.soft`, `textDecoration: none`, `_hover/_focusVisible: { color: accent.deep }`, transition tokens |
|
||||
| `skipNavLink` | Recipe override (Chakra built-in) | `bg: ink`, `color: white`, `rounded: none`, design padding, `textStyle: eyebrow` |
|
||||
| `iconControl` | New recipe | `opacity: 0.6`, `_hover/_focusVisible: { opacity: 1 }`, `interaction`/`smooth` transitions |
|
||||
@@ -0,0 +1,127 @@
|
||||
# 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`
|
||||
@@ -0,0 +1,34 @@
|
||||
# Services — frontend-shell
|
||||
|
||||
There is no back-end or service layer in this SPA. The cross-cutting "services" the shell relies on are configuration-level and listed here with how they are orchestrated.
|
||||
|
||||
## Routing service (TanStack Router)
|
||||
- **Configured in**: `main.tsx` (`createRouter`) and `routes/__root.tsx` (`createRootRoute`)
|
||||
- **Responsibilities**:
|
||||
- File-based route tree, including the four new placeholder routes.
|
||||
- **Scroll restoration** (`scrollRestoration: true`): a new navigation starts at the top, and back/forward restores the previous position (FR-08).
|
||||
- **Not found**: the root route's `notFoundComponent: NotFound`. For an unknown URL, the root component (`AppShell`) keeps rendering and `NotFound` appears in its `<Outlet>`, so the shell stays visible. Verified in `@tanstack/react-router` `Match.js`: a global not-found renders through the root match's `Outlet`.
|
||||
- **Errors**: `defaultErrorComponent: ErrorPage` on the router, plus `errorComponent: ErrorPage` on the root.
|
||||
- An error in a page route is caught at that page's match, inside the shell.
|
||||
- An error in the shell itself falls back to the root's boundary and renders `ErrorPage` without the shell. This is a deliberate fail-safe (SECURITY-15).
|
||||
|
||||
## Head management service
|
||||
- **Configured in**: `seo.ts` and each route's `head`; rendered by `HeadContent` in the root layout
|
||||
- **Responsibilities**:
|
||||
- Per-page title and description via `pageHead`; site-wide Open Graph tags via `siteHead`.
|
||||
- The 404 page sets its own title plus `robots: noindex`. A global not-found has no route of its own whose `head` could do this, so the mechanism is settled in Functional Design.
|
||||
|
||||
## Content provisioning
|
||||
- **Today**: static modules in `content/` (`siteContent`, `heroContent`)
|
||||
- **Orchestration** (application design Q3 = A):
|
||||
- `AppShell` imports `siteContent` and passes it to `Footer`.
|
||||
- The home route passes `heroContent` and `siteContent.socials` to `Hero`.
|
||||
- Components never import content themselves.
|
||||
- **Later**: the import points (`AppShell`, the home route) are replaced by route loaders or API calls. The components and types stay the same.
|
||||
|
||||
## Scroll state
|
||||
- `useScrolledPast` is the one scroll-listening primitive (passive listener). It is used by `NavigationBar` (150px threshold) and `BackToTop` (60% of the viewport).
|
||||
|
||||
## Theme service (Chakra system)
|
||||
- `theme.ts` with `createSystem(defaultConfig, config)`
|
||||
- New and overridden recipes are merged into Chakra's default config. Components consume them through `Link variant="subtle"`, `SkipNavLink`, `useRecipe({ key: 'iconControl' })` and `LinkButton`.
|
||||
Reference in New Issue
Block a user