Completes the front-end shell with footer, status pages and SEO
Adds the footer, back-to-top button, skip link, placeholder routes, 404 and error pages inside the shell, plus per-page SEO from a single page registry (canonical URLs, Open Graph image, JSON-LD, generated sitemap.xml and robots.txt). Theme tokens and recipes replace repeated styling, the hero loads only the active and neighbouring slides, and the e-mail address is joined in the browser to keep it out of the HTML and bundle. Adds Vitest with property-based (fast-check) and axe tests, ESLint, security headers for dev and preview, Lighthouse CI and a `pnpm check` script that runs all quality gates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -22,3 +22,7 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# Testdekking en Lighthouse CI
|
||||
coverage
|
||||
.lighthouseci
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
**/.ai
|
||||
|
||||
**/routeTree.gen.ts
|
||||
**/routeTree.gen.ts
|
||||
.lighthouseci
|
||||
coverage
|
||||
dist
|
||||
pnpm-lock.yaml
|
||||
.agents
|
||||
.claude
|
||||
.junie
|
||||
.tanstack
|
||||
skills-lock.json
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { contentSecurityPolicy, securityHeaders } from './securityHeaders';
|
||||
|
||||
const directive = (csp: string, name: string) =>
|
||||
csp.split('; ').find((d) => d.startsWith(name + ' ')) ?? '';
|
||||
|
||||
describe('securityHeaders', () => {
|
||||
it('productie-CSP heeft geen onveilige uitzonderingen voor scripts', () => {
|
||||
const csp = contentSecurityPolicy('production');
|
||||
expect(csp).not.toContain('unsafe-eval');
|
||||
expect(directive(csp, 'script-src')).toBe("script-src 'self'");
|
||||
expect(csp).not.toContain('ws:');
|
||||
expect(directive(csp, 'frame-ancestors')).toBe(
|
||||
"frame-ancestors 'none'",
|
||||
);
|
||||
});
|
||||
|
||||
it('dev-CSP voegt alleen toe wat Vite nodig heeft', () => {
|
||||
const csp = contentSecurityPolicy('development');
|
||||
expect(directive(csp, 'script-src')).toBe(
|
||||
"script-src 'self' 'unsafe-inline'",
|
||||
);
|
||||
expect(directive(csp, 'connect-src')).toBe("connect-src 'self' ws:");
|
||||
expect(csp).not.toContain('unsafe-eval');
|
||||
});
|
||||
|
||||
it('zet alle verplichte headers', () => {
|
||||
expect(securityHeaders('production')).toMatchObject({
|
||||
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'X-Frame-Options': 'DENY',
|
||||
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,49 @@
|
||||
// HTTP-securityheaders voor de Vite dev- en preview-server. De productieset is
|
||||
// ook het voorschrift voor de toekomstige host (zie NFR-SEC-01/02).
|
||||
|
||||
type Mode = 'production' | 'development';
|
||||
|
||||
// Chakra/Emotion zetten tijdens runtime <style>-tags in de pagina, daarom
|
||||
// staat style-src 'unsafe-inline' toe. Scripts komen alleen van de eigen site.
|
||||
const productionCsp: Record<string, string[]> = {
|
||||
'default-src': ["'self'"],
|
||||
'script-src': ["'self'"],
|
||||
'style-src': ["'self'", "'unsafe-inline'"],
|
||||
'img-src': ["'self'", 'data:'],
|
||||
'font-src': ["'self'"],
|
||||
'connect-src': ["'self'"],
|
||||
'object-src': ["'none'"],
|
||||
'base-uri': ["'self'"],
|
||||
'form-action': ["'self'"],
|
||||
'frame-ancestors': ["'none'"],
|
||||
};
|
||||
|
||||
// Alleen wat de Vite dev-server zelf nodig heeft: een inline script voor
|
||||
// React Refresh en een websocket voor hot reload.
|
||||
const developmentExtras: Record<string, string[]> = {
|
||||
'script-src': ["'unsafe-inline'"],
|
||||
'connect-src': ['ws:'],
|
||||
};
|
||||
|
||||
export function contentSecurityPolicy(mode: Mode): string {
|
||||
return Object.entries(productionCsp)
|
||||
.map(([directive, sources]) => {
|
||||
const extra =
|
||||
mode === 'development'
|
||||
? (developmentExtras[directive] ?? [])
|
||||
: [];
|
||||
return [directive, ...sources, ...extra].join(' ');
|
||||
})
|
||||
.join('; ');
|
||||
}
|
||||
|
||||
export function securityHeaders(mode: Mode): Record<string, string> {
|
||||
return {
|
||||
'Content-Security-Policy': contentSecurityPolicy(mode),
|
||||
// Browsers negeren HSTS over http://localhost; telt pas op de echte host
|
||||
'Strict-Transport-Security': 'max-age=31536000; includeSubDomains',
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'X-Frame-Options': 'DENY',
|
||||
'Referrer-Policy': 'strict-origin-when-cross-origin',
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { Plugin } from 'vite';
|
||||
import { siteUrl } from '../src/seo.ts';
|
||||
import sitePages, { pageList } from '../src/sitePages.ts';
|
||||
import { sitemapXml } from '../src/sitemap.ts';
|
||||
|
||||
// Maakt bij elke build dist/sitemap.xml uit het pagina-register. Route-heads
|
||||
// lezen hetzelfde register, dus sitemap en noindex lopen nooit uit elkaar.
|
||||
export default function sitemapPlugin(): Plugin {
|
||||
return {
|
||||
name: 'slp-sitemap',
|
||||
apply: 'build',
|
||||
generateBundle() {
|
||||
this.emitFile({
|
||||
type: 'asset',
|
||||
fileName: 'sitemap.xml',
|
||||
source: sitemapXml(pageList(sitePages), siteUrl),
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { TestProject } from 'vitest/node';
|
||||
|
||||
// Kiest één seed voor alle property-tests van een run en logt die altijd,
|
||||
// ook als alles slaagt (PBT-08). Opnieuw afspelen: FC_SEED=<seed> pnpm test
|
||||
export default function setup(project: TestProject) {
|
||||
const env = (
|
||||
globalThis as { process?: { env: Record<string, string | undefined> } }
|
||||
).process?.env;
|
||||
const seed = Number(env?.FC_SEED ?? Math.floor(Math.random() * 2 ** 31));
|
||||
console.log(
|
||||
`\nfast-check seed: ${seed} (opnieuw: FC_SEED=${seed} pnpm test)\n`,
|
||||
);
|
||||
project.provide('fcSeed', seed);
|
||||
}
|
||||
|
||||
declare module 'vitest' {
|
||||
export interface ProvidedContext {
|
||||
fcSeed: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import js from '@eslint/js';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
||||
|
||||
// Alleen regels die fouten vinden; opmaak is aan Prettier
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: [
|
||||
'dist',
|
||||
'coverage',
|
||||
'.lighthouseci',
|
||||
'.agents',
|
||||
'.claude',
|
||||
'.junie',
|
||||
'.tanstack',
|
||||
'src/routeTree.gen.ts',
|
||||
],
|
||||
},
|
||||
{
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
reactHooks.configs.flat.recommended,
|
||||
jsxA11y.flatConfigs.recommended,
|
||||
],
|
||||
languageOptions: {
|
||||
globals: globals.browser,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.{js,cjs}'],
|
||||
extends: [js.configs.recommended],
|
||||
languageOptions: {
|
||||
globals: globals.node,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -1,25 +1,62 @@
|
||||
<!doctype html>
|
||||
<html lang="nl">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="apple-touch-icon" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!--
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="apple-touch-icon" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<!--
|
||||
Fallback voor crawlers en link-previews die geen JavaScript uitvoeren.
|
||||
Zodra de app start, worden deze tags verwijderd (zie main.tsx) en zet
|
||||
elke route zijn eigen titel en beschrijving (zie src/seo.ts).
|
||||
-->
|
||||
<title data-fallback>Lifestyle fotograaf in Huizen | Andrea Slop Fotografie</title>
|
||||
<meta data-fallback name="description" content="Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots." />
|
||||
<meta data-fallback property="og:site_name" content="Andrea Slop Fotografie" />
|
||||
<meta data-fallback property="og:locale" content="nl_NL" />
|
||||
<meta data-fallback property="og:type" content="website" />
|
||||
<meta data-fallback property="og:title" content="Lifestyle fotograaf in Huizen | Andrea Slop Fotografie" />
|
||||
<meta data-fallback property="og:description" content="Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots." />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
<title data-fallback>
|
||||
Lifestyle fotograaf in Huizen | Andrea Slop Fotografie
|
||||
</title>
|
||||
<meta
|
||||
data-fallback
|
||||
name="description"
|
||||
content="Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots."
|
||||
/>
|
||||
<meta
|
||||
data-fallback
|
||||
property="og:site_name"
|
||||
content="Andrea Slop Fotografie"
|
||||
/>
|
||||
<meta data-fallback property="og:locale" content="nl_NL" />
|
||||
<meta data-fallback property="og:type" content="website" />
|
||||
<meta
|
||||
data-fallback
|
||||
property="og:title"
|
||||
content="Lifestyle fotograaf in Huizen | Andrea Slop Fotografie"
|
||||
/>
|
||||
<meta
|
||||
data-fallback
|
||||
property="og:description"
|
||||
content="Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots."
|
||||
/>
|
||||
<meta
|
||||
data-fallback
|
||||
property="og:url"
|
||||
content="https://andreaslop.nl/"
|
||||
/>
|
||||
<meta
|
||||
data-fallback
|
||||
property="og:image"
|
||||
content="https://andreaslop.nl/og-image.jpg"
|
||||
/>
|
||||
<meta
|
||||
data-fallback
|
||||
property="og:image:alt"
|
||||
content="Takjes paarse heide op een arm met een bloementattoo"
|
||||
/>
|
||||
<meta data-fallback property="og:image:width" content="1200" />
|
||||
<meta data-fallback property="og:image:height" content="630" />
|
||||
<meta data-fallback name="twitter:card" content="summary_large_image" />
|
||||
<link data-fallback rel="canonical" href="https://andreaslop.nl/" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// Lighthouse CI tegen de gebouwde site (`pnpm preview`), zodat de echte
|
||||
// securityheaders en de SPA-fallback meetellen. Doelen: NFR-P-01, NFR-A-01,
|
||||
// NFR-S-01/02. Dit is de mobiele meting; lighthouserc.desktop.cjs bouwt hierop
|
||||
// voort voor desktop. `pnpm lighthouse` draait beide.
|
||||
|
||||
const origin = 'http://localhost:4173';
|
||||
|
||||
// Moet gelijk lopen met src/sitePages.ts (een test bewaakt dat)
|
||||
const indexedPaths = ['/'];
|
||||
const noindexPaths = [
|
||||
'/over-mij',
|
||||
'/portfolio',
|
||||
'/soorten-fotoshoots',
|
||||
'/contact',
|
||||
'/privacyverklaring',
|
||||
];
|
||||
const notFoundPath = '/bestaat-niet';
|
||||
|
||||
// Homepage mobiel voorlopig 0,8: de foto's zijn nog niet responsive en de
|
||||
// titel verschijnt pas na de JavaScript. Komt terug op 0,9 met responsive
|
||||
// afbeeldingen uit de API/CMS en prerendering (NFR-P-01).
|
||||
const homeMobilePerformance = 0.8;
|
||||
|
||||
const quality = {
|
||||
'categories:performance': ['error', { minScore: 0.9 }],
|
||||
'categories:accessibility': ['error', { minScore: 1 }],
|
||||
'categories:best-practices': ['error', { minScore: 1 }],
|
||||
};
|
||||
|
||||
// SEO-audits die ook voor noindex-pagina's moeten slagen. Alleen
|
||||
// `is-crawlable` mag falen: die pagina's staan bewust op noindex.
|
||||
const seoBasics = {
|
||||
'document-title': 'error',
|
||||
'link-text': 'error',
|
||||
'crawlable-anchors': 'error',
|
||||
'image-alt': 'error',
|
||||
};
|
||||
|
||||
const escape = (path) => path.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&');
|
||||
const exact = (paths) => `^${origin}(${paths.map(escape).join('|')})$`;
|
||||
|
||||
module.exports = {
|
||||
indexedPaths,
|
||||
noindexPaths,
|
||||
notFoundPath,
|
||||
ci: {
|
||||
collect: {
|
||||
startServerCommand: 'pnpm preview --port 4173 --strictPort',
|
||||
startServerReadyPattern: 'Local',
|
||||
url: [...indexedPaths, ...noindexPaths, notFoundPath].map(
|
||||
(path) => origin + path,
|
||||
),
|
||||
numberOfRuns: 1,
|
||||
},
|
||||
assert: {
|
||||
assertMatrix: [
|
||||
{
|
||||
matchingUrlPattern: exact(indexedPaths),
|
||||
assertions: {
|
||||
...quality,
|
||||
'categories:performance': [
|
||||
'error',
|
||||
{ minScore: homeMobilePerformance },
|
||||
],
|
||||
'categories:seo': ['error', { minScore: 1 }],
|
||||
},
|
||||
},
|
||||
{
|
||||
matchingUrlPattern: exact(noindexPaths),
|
||||
assertions: {
|
||||
...quality,
|
||||
...seoBasics,
|
||||
'meta-description': 'error',
|
||||
canonical: 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
matchingUrlPattern: exact([notFoundPath]),
|
||||
assertions: { ...quality, ...seoBasics },
|
||||
},
|
||||
],
|
||||
},
|
||||
upload: {
|
||||
// Resultaten blijven lokaal in .lighthouseci/
|
||||
target: 'filesystem',
|
||||
outputDir: '.lighthouseci',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
// Types voor lighthouserc.cjs, zodat een test de URL-lijsten kan vergelijken
|
||||
// met het pagina-register
|
||||
declare const config: {
|
||||
indexedPaths: string[];
|
||||
noindexPaths: string[];
|
||||
notFoundPath: string;
|
||||
ci: unknown;
|
||||
};
|
||||
|
||||
export = config;
|
||||
@@ -0,0 +1,27 @@
|
||||
// Desktopmeting: zelfde pagina's en doelen als mobiel, maar ook de homepage
|
||||
// moet hier Performance 0,9 halen.
|
||||
const base = require('./lighthouserc.cjs');
|
||||
|
||||
const [home, ...rest] = base.ci.assert.assertMatrix;
|
||||
|
||||
module.exports = {
|
||||
ci: {
|
||||
...base.ci,
|
||||
collect: {
|
||||
...base.ci.collect,
|
||||
settings: { preset: 'desktop' },
|
||||
},
|
||||
assert: {
|
||||
assertMatrix: [
|
||||
{
|
||||
...home,
|
||||
assertions: {
|
||||
...home.assertions,
|
||||
'categories:performance': ['error', { minScore: 0.9 }],
|
||||
},
|
||||
},
|
||||
...rest,
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -7,19 +7,46 @@
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"postinstall": "chakra typegen ./src/theme.ts",
|
||||
"typegen": "chakra typegen ./src/theme.ts",
|
||||
"typegen:watch": "chakra typegen ./src/theme.ts --watch"
|
||||
"typegen:watch": "chakra typegen ./src/theme.ts --watch",
|
||||
"test": "vitest run --coverage",
|
||||
"test:watch": "vitest",
|
||||
"lint": "eslint .",
|
||||
"format:check": "prettier --check .",
|
||||
"audit:deps": "pnpm audit --prod --audit-level high",
|
||||
"audit:dev": "pnpm audit || echo Meldingen in ontwikkeltools blokkeren niet (NFR-SEC-05)",
|
||||
"lighthouse": "lhci autorun && lhci autorun --config=lighthouserc.desktop.cjs",
|
||||
"check": "pnpm lint && pnpm format:check && pnpm test && pnpm build && pnpm audit:deps && pnpm audit:dev && pnpm lighthouse"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@chakra-ui/cli": "^3.37.0",
|
||||
"@eslint/js": "^9.39.5",
|
||||
"@iconify-icons/ant-design": "2.0.1",
|
||||
"@iconify/react": "^6.0.2",
|
||||
"@lhci/cli": "^0.15.1",
|
||||
"@tanstack/react-router-devtools": "^1.167.2",
|
||||
"@tanstack/router-plugin": "^1.168.40",
|
||||
"@testing-library/dom": "^10.4.2",
|
||||
"@testing-library/jest-dom": "^7.0.1",
|
||||
"@testing-library/react": "^16.3.3",
|
||||
"@testing-library/user-event": "^14.6.8",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@vitejs/plugin-react": "^6.1.2",
|
||||
"@vitest/coverage-v8": "^5.0.5",
|
||||
"axe-core": "^4.14.0",
|
||||
"eslint": "^9.39.5",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"fast-check": "^4.10.2",
|
||||
"globals": "^17.13.0",
|
||||
"jsdom": "^30.1.3",
|
||||
"prettier": "^3.9.9",
|
||||
"typescript": "~6.0.2",
|
||||
"vite": "^8.3.0"
|
||||
"typescript-eslint": "^8.71.2",
|
||||
"vite": "^8.3.0",
|
||||
"vitest": "^5.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@chakra-ui/react": "^3.37.0",
|
||||
@@ -27,9 +54,6 @@
|
||||
"@fontsource/jost": "^5.3.0",
|
||||
"@fontsource/marcellus": "^5.3.0",
|
||||
"@tanstack/react-router": "^1.170.39",
|
||||
"@tanstack/react-router-devtools": "^1.167.2",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.3.0",
|
||||
"react-dom": "^19.3.0"
|
||||
}
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
allowBuilds:
|
||||
esbuild: true
|
||||
esbuild: true
|
||||
|
||||
# Veiligheidspatch (GHSA-68fv-2mgg-jv7q) voor de Vite/Vitest-keten
|
||||
overrides:
|
||||
source-map-js: ^1.2.2
|
||||
|
||||
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 92 KiB |
@@ -0,0 +1,4 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://andreaslop.nl/sitemap.xml
|
||||
@@ -0,0 +1,139 @@
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import {
|
||||
createMemoryHistory,
|
||||
createRouter,
|
||||
RouterProvider,
|
||||
} from '@tanstack/react-router';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import lighthouseConfig from '../lighthouserc.cjs';
|
||||
import ErrorPage from './components/StatusPage/ErrorPage';
|
||||
import { routeTree } from './routeTree.gen';
|
||||
import sitePages from './sitePages';
|
||||
import { axeResults } from './test/axe';
|
||||
import system from './theme';
|
||||
|
||||
// Laat PageIntro op verzoek crashen, om de foutpagina binnen de shell te testen
|
||||
const crash = vi.hoisted(() => ({ enabled: false }));
|
||||
vi.mock('./components/PageIntro/PageIntro', async (importOriginal) => {
|
||||
const original =
|
||||
await importOriginal<
|
||||
typeof import('./components/PageIntro/PageIntro')
|
||||
>();
|
||||
return {
|
||||
default: (props: Parameters<typeof original.default>[0]) => {
|
||||
if (crash.enabled) throw new Error('kapot');
|
||||
return original.default(props);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
crash.enabled = false;
|
||||
});
|
||||
|
||||
// De echte app: route tree, router-opties en thema zoals in main.tsx
|
||||
async function renderApp(path: string) {
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
history: createMemoryHistory({ initialEntries: [path] }),
|
||||
scrollRestoration: true,
|
||||
defaultErrorComponent: ErrorPage,
|
||||
});
|
||||
await router.load();
|
||||
const result = render(
|
||||
<ChakraProvider value={system}>
|
||||
<RouterProvider router={router} />
|
||||
</ChakraProvider>,
|
||||
);
|
||||
return { ...result, router };
|
||||
}
|
||||
|
||||
const expectShell = () => {
|
||||
expect(screen.getByRole('banner')).toBeInTheDocument();
|
||||
expect(screen.getByRole('contentinfo')).toBeInTheDocument();
|
||||
};
|
||||
|
||||
describe('app', () => {
|
||||
it.each(Object.keys(sitePages))(
|
||||
'%s rendert binnen de shell met een h1 en zonder axe-fouten',
|
||||
async (path) => {
|
||||
const { container } = await renderApp(path);
|
||||
expectShell();
|
||||
expect(
|
||||
await screen.findAllByRole('heading', { level: 1 }),
|
||||
).toHaveLength(1);
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
},
|
||||
);
|
||||
|
||||
it('zet titel en noindex van een placeholder in de head', async () => {
|
||||
await renderApp('/portfolio');
|
||||
await screen.findByRole('heading', { level: 1, name: 'Portfolio' });
|
||||
expect(document.title).toBe('Portfolio | Andrea Slop Fotografie');
|
||||
expect(
|
||||
document.head.querySelector('link[rel="canonical"]'),
|
||||
).toHaveAttribute('href', 'https://andreaslop.nl/portfolio');
|
||||
expect(
|
||||
document.head.querySelector('meta[name="robots"]'),
|
||||
).toHaveAttribute('content', 'noindex');
|
||||
});
|
||||
|
||||
// Een data-script blijft staan waar HeadContent rendert (in de body);
|
||||
// React verplaatst alleen title, meta en link. Google leest JSON-LD overal.
|
||||
it('zet precies een blok gestructureerde data in de pagina', async () => {
|
||||
await renderApp('/');
|
||||
const scripts = document.querySelectorAll(
|
||||
'script[type="application/ld+json"]',
|
||||
);
|
||||
expect(scripts).toHaveLength(1);
|
||||
expect(JSON.parse(scripts[0].textContent!)['@type']).toBe(
|
||||
'ProfessionalService',
|
||||
);
|
||||
});
|
||||
|
||||
it('toont een onbekende URL als 404 binnen de shell', async () => {
|
||||
const { container } = await renderApp('/bestaat-niet');
|
||||
expect(
|
||||
await screen.findByRole('heading', {
|
||||
level: 1,
|
||||
name: 'Pagina niet gevonden',
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
expectShell();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('toont een fout in een pagina als foutpagina binnen de shell', async () => {
|
||||
crash.enabled = true;
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {});
|
||||
await renderApp('/portfolio');
|
||||
expect(
|
||||
await screen.findByRole('heading', {
|
||||
level: 1,
|
||||
name: 'Er ging iets mis',
|
||||
}),
|
||||
).toBeInTheDocument();
|
||||
expectShell();
|
||||
expect(document.body).not.toHaveTextContent('kapot');
|
||||
});
|
||||
});
|
||||
|
||||
describe('pagina-register', () => {
|
||||
it('bevat precies de routes van de route tree', async () => {
|
||||
const { router } = await renderApp('/');
|
||||
const routePaths = Object.keys(router.routesByPath).sort();
|
||||
expect(Object.keys(sitePages).sort()).toEqual(routePaths);
|
||||
});
|
||||
|
||||
it('loopt gelijk met de URLs van Lighthouse CI', () => {
|
||||
const indexed = Object.entries(sitePages)
|
||||
.filter(([, page]) => page.indexed)
|
||||
.map(([path]) => path);
|
||||
const noindex = Object.entries(sitePages)
|
||||
.filter(([, page]) => !page.indexed)
|
||||
.map(([path]) => path);
|
||||
expect(lighthouseConfig.indexedPaths).toEqual(indexed);
|
||||
expect(lighthouseConfig.noindexPaths).toEqual(noindex);
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 433 KiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 223 KiB |
|
Before Width: | Height: | Size: 13 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="32" height="32" viewBox="0 0 256 256"><path fill="#007ACC" d="M0 128v128h256V0H0z"/><path fill="#FFF" d="m56.612 128.85l-.081 10.483h33.32v94.68h23.568v-94.68h33.321v-10.28c0-5.69-.122-10.444-.284-10.566c-.122-.162-20.4-.244-44.983-.203l-44.74.122l-.121 10.443Zm149.955-10.742c6.501 1.625 11.459 4.51 16.01 9.224c2.357 2.52 5.851 7.111 6.136 8.208c.08.325-11.053 7.802-17.798 11.988c-.244.162-1.22-.894-2.317-2.52c-3.291-4.795-6.745-6.867-12.028-7.233c-7.76-.528-12.759 3.535-12.718 10.321c0 1.992.284 3.17 1.097 4.795c1.707 3.536 4.876 5.649 14.832 9.956c18.326 7.883 26.168 13.084 31.045 20.48c5.445 8.249 6.664 21.415 2.966 31.208c-4.063 10.646-14.14 17.879-28.323 20.276c-4.388.772-14.79.65-19.504-.203c-10.28-1.828-20.033-6.908-26.047-13.572c-2.357-2.6-6.949-9.387-6.664-9.874c.122-.163 1.178-.813 2.356-1.504c1.138-.65 5.446-3.129 9.509-5.485l7.355-4.267l1.544 2.276c2.154 3.29 6.867 7.801 9.712 9.305c8.167 4.307 19.383 3.698 24.909-1.26c2.357-2.153 3.332-4.388 3.332-7.68c0-2.966-.366-4.266-1.91-6.501c-1.99-2.845-6.054-5.242-17.595-10.24c-13.206-5.69-18.895-9.224-24.096-14.832c-3.007-3.25-5.852-8.452-7.03-12.8c-.975-3.617-1.22-12.678-.447-16.335c2.723-12.76 12.353-21.659 26.25-24.3c4.51-.853 14.994-.528 19.424.569Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,32 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import AppShell from './AppShell';
|
||||
|
||||
describe('AppShell', () => {
|
||||
it('heeft de landmarks van de shell', async () => {
|
||||
const { container } = await renderWithProviders(<AppShell />);
|
||||
expect(screen.getByRole('banner')).toBeInTheDocument();
|
||||
expect(screen.getByRole('main')).toHaveAttribute('id', 'main');
|
||||
expect(screen.getByRole('contentinfo')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('navigation', { name: 'Hoofdmenu' }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('navigation', { name: 'Footermenu' }),
|
||||
).toBeInTheDocument();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('begint met een skip link naar de inhoud', async () => {
|
||||
const { container } = await renderWithProviders(<AppShell />);
|
||||
const skip = screen.getByRole('link', {
|
||||
name: 'Direct naar de inhoud',
|
||||
});
|
||||
expect(skip).toHaveAttribute('href', '#main');
|
||||
// Eerste focusbare element van de pagina
|
||||
expect(container.querySelector('a, button')).toBe(skip);
|
||||
expect(screen.getByRole('main')).toHaveAttribute('tabindex', '-1');
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,27 @@
|
||||
import { SkipNavContent, SkipNavLink } from '@chakra-ui/react';
|
||||
import { Outlet } from '@tanstack/react-router';
|
||||
import siteContent from '@/content/siteContent';
|
||||
import useRouteFocus from '@/hooks/useRouteFocus';
|
||||
import BackToTop from './BackToTop/BackToTop';
|
||||
import Footer from './Footer/Footer';
|
||||
import NavigationBar from './NavigationBar/NavigationBar';
|
||||
import Footer from './Footer';
|
||||
|
||||
// Het frame om elke pagina (LAYOUT.md "Shell"): header, inhoud en footer.
|
||||
// Hier komt de site-brede content binnen; straks uit een loader of de API.
|
||||
export default function AppShell() {
|
||||
useRouteFocus();
|
||||
|
||||
return (
|
||||
<>
|
||||
<SkipNavLink id="main" data-testid="skip-link">
|
||||
Direct naar de inhoud
|
||||
</SkipNavLink>
|
||||
<NavigationBar />
|
||||
<Outlet />
|
||||
<Footer />
|
||||
<SkipNavContent as="main" id="main">
|
||||
<Outlet />
|
||||
</SkipNavContent>
|
||||
<Footer content={siteContent} />
|
||||
<BackToTop />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
import { act, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import BackToTop from './BackToTop';
|
||||
|
||||
const scrollTo = (y: number) =>
|
||||
act(() => {
|
||||
Object.defineProperty(window, 'scrollY', {
|
||||
value: y,
|
||||
configurable: true,
|
||||
});
|
||||
window.dispatchEvent(new Event('scroll'));
|
||||
});
|
||||
|
||||
const reducedMotion = (matches: boolean) =>
|
||||
vi.spyOn(window, 'matchMedia').mockImplementation(
|
||||
(query: string) =>
|
||||
({
|
||||
matches: matches && query.includes('reduce'),
|
||||
media: query,
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
}) as unknown as MediaQueryList,
|
||||
);
|
||||
|
||||
const renderButton = () =>
|
||||
renderWithProviders(
|
||||
<>
|
||||
<main id="main" tabIndex={-1}>
|
||||
inhoud
|
||||
</main>
|
||||
<BackToTop />
|
||||
</>,
|
||||
);
|
||||
|
||||
const button = () => screen.getByTestId('back-to-top-button');
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(window, 'scrollY', { value: 0, configurable: true });
|
||||
});
|
||||
|
||||
describe('BackToTop', () => {
|
||||
it('is bovenaan inert: niet focusbaar en niet voorgelezen', async () => {
|
||||
await renderButton();
|
||||
expect(button()).toHaveAttribute('inert');
|
||||
expect(
|
||||
screen.queryByRole('button', { name: 'Terug naar boven' }),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it('verschijnt pas voorbij 60% van de viewporthoogte', async () => {
|
||||
await renderButton();
|
||||
const threshold = 0.6 * window.innerHeight;
|
||||
await scrollTo(threshold);
|
||||
expect(button()).toHaveAttribute('inert');
|
||||
await scrollTo(threshold + 1);
|
||||
expect(button()).not.toHaveAttribute('inert');
|
||||
expect(screen.getByRole('button', { name: 'Terug naar boven' })).toBe(
|
||||
button(),
|
||||
);
|
||||
});
|
||||
|
||||
it('scrolt soepel naar boven en zet de focus op de inhoud', async () => {
|
||||
const scroll = vi
|
||||
.spyOn(window, 'scrollTo')
|
||||
.mockImplementation(() => {});
|
||||
const { container } = await renderButton();
|
||||
await scrollTo(2000);
|
||||
await userEvent.click(button());
|
||||
expect(scroll).toHaveBeenCalledWith({ top: 0, behavior: 'smooth' });
|
||||
expect(document.activeElement).toBe(document.getElementById('main'));
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('springt direct naar boven bij reduced motion', async () => {
|
||||
reducedMotion(true);
|
||||
const scroll = vi
|
||||
.spyOn(window, 'scrollTo')
|
||||
.mockImplementation(() => {});
|
||||
await renderButton();
|
||||
await scrollTo(2000);
|
||||
await userEvent.click(button());
|
||||
expect(scroll).toHaveBeenCalledWith({ top: 0, behavior: 'instant' });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
import { chakra } from '@chakra-ui/react';
|
||||
import { Icon } from '@iconify/react/offline';
|
||||
import upOutlined from '@iconify-icons/ant-design/up-outlined';
|
||||
import useScrolledPast from '@/hooks/useScrolledPast';
|
||||
import { backToTopThreshold } from '@/lib/backToTopThreshold';
|
||||
|
||||
// Buiten het component, zodat de functie stabiel is voor useScrolledPast
|
||||
const threshold = () => backToTopThreshold(window.innerHeight);
|
||||
|
||||
// Afstand tot de rand zoals in het design. Op hele brede schermen lijnt de
|
||||
// knop uit met de rand van de content in plaats van de hoek van het scherm.
|
||||
const EDGE = 'clamp(1rem, 3vw, 2rem)';
|
||||
|
||||
// Vaste knop rechtsonder om terug naar boven te gaan (FR-06, BR-TOP-*)
|
||||
export default function BackToTop() {
|
||||
const visible = useScrolledPast(threshold);
|
||||
|
||||
const scrollToTop = () => {
|
||||
const reduced = window.matchMedia(
|
||||
'(prefers-reduced-motion: reduce)',
|
||||
).matches;
|
||||
window.scrollTo({ top: 0, behavior: reduced ? 'instant' : 'smooth' });
|
||||
// De knop verdwijnt bovenaan; de focus gaat naar de inhoud
|
||||
document.getElementById('main')?.focus({ preventScroll: true });
|
||||
};
|
||||
|
||||
return (
|
||||
<chakra.button
|
||||
type="button"
|
||||
onClick={scrollToTop}
|
||||
aria-label="Terug naar boven"
|
||||
data-testid="back-to-top-button"
|
||||
position="fixed"
|
||||
bottom={EDGE}
|
||||
right={`max(${EDGE}, calc((100vw - {sizes.content}) / 2 + {spacing.8}))`}
|
||||
zIndex="backToTop"
|
||||
display="inline-flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
w="46px"
|
||||
h="46px"
|
||||
bg="ink"
|
||||
color="white"
|
||||
fontSize="1.1rem"
|
||||
cursor="pointer"
|
||||
// Verborgen = niet zichtbaar, niet focusbaar, niet klikbaar en
|
||||
// niet voorgelezen (BR-TOP-03); inert dekt dat ook zonder CSS af
|
||||
inert={!visible}
|
||||
visibility={visible ? 'visible' : 'hidden'}
|
||||
opacity={visible ? 1 : 0}
|
||||
transform={visible ? 'none' : 'translateY(8px)'}
|
||||
transitionProperty="opacity, transform, visibility, background-color"
|
||||
transitionDuration="interaction"
|
||||
transitionTimingFunction="smooth"
|
||||
_hover={{ bg: 'accent.deep' }}
|
||||
_focusVisible={{ bg: 'accent.deep' }}
|
||||
_motionReduce={{ transitionDuration: '0s', transform: 'none' }}
|
||||
>
|
||||
<Icon icon={upOutlined} aria-hidden />
|
||||
</chakra.button>
|
||||
);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
export default function Footer() {
|
||||
return (
|
||||
<footer className="p-2 text-center">
|
||||
<p className="text-sm text-gray-500">
|
||||
© {new Date().getFullYear()} Andrea Slop Fotografie. All
|
||||
rights reserved.
|
||||
</p>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import siteContent from '@/content/siteContent';
|
||||
import type { SiteContent } from '@/content/types';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import Footer from './Footer';
|
||||
|
||||
const renderFooter = (content: SiteContent = siteContent, path = '/') =>
|
||||
renderWithProviders(<Footer content={content} />, { path });
|
||||
|
||||
describe('Footer', () => {
|
||||
it('toont merk, socials en contact met h2-koppen', async () => {
|
||||
const { container } = await renderFooter();
|
||||
expect(
|
||||
screen.getByRole('img', { name: 'Andrea Slop Fotografie' }),
|
||||
).toBeInTheDocument();
|
||||
// Regelafbreking uit de content blijft in de tekst staan
|
||||
expect(
|
||||
screen.getByText(siteContent.footerIntro, {
|
||||
normalizer: (text) => text,
|
||||
}),
|
||||
).toHaveStyle({ whiteSpace: 'pre-line' });
|
||||
const headings = screen.getAllByRole('heading', { level: 2 });
|
||||
// Naam in gewone schrijfwijze, los van de CSS-hoofdletters
|
||||
expect(headings.map((h) => h.getAttribute('aria-label'))).toEqual([
|
||||
'Socials',
|
||||
'Contact',
|
||||
]);
|
||||
expect(headings.map((h) => h.textContent)).toEqual([
|
||||
'Socials',
|
||||
'Contact',
|
||||
]);
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('opent socials veilig in een nieuw tabblad en meldt dat', async () => {
|
||||
await renderFooter();
|
||||
const link = screen.getByRole('link', {
|
||||
name: 'Facebook (opent in nieuw tabblad)',
|
||||
});
|
||||
expect(link).toHaveAttribute('target', '_blank');
|
||||
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
||||
expect(link).toHaveAttribute('href', siteContent.socials[0].href);
|
||||
});
|
||||
|
||||
it('voegt het e-mailadres pas bij het tonen samen', async () => {
|
||||
await renderFooter();
|
||||
const link = screen.getByTestId('footer-email-link');
|
||||
expect(link).toHaveAttribute('href', 'mailto:info@andreaslop.nl');
|
||||
expect(link).toHaveTextContent('info@andreaslop.nl');
|
||||
});
|
||||
|
||||
it('toont het huidige jaar', async () => {
|
||||
await renderFooter();
|
||||
expect(
|
||||
screen.getByText(
|
||||
`© ${new Date().getFullYear()} Andrea Slop Fotografie`,
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('heeft een footermenu dat de actieve pagina markeert', async () => {
|
||||
await renderFooter(siteContent, '/portfolio');
|
||||
const nav = screen.getByRole('navigation', { name: 'Footermenu' });
|
||||
const links = within(nav).getAllByRole('link');
|
||||
expect(links.map((l) => l.textContent)).toEqual([
|
||||
'Portfolio',
|
||||
'Soorten fotoshoots',
|
||||
'Contact',
|
||||
'Privacyverklaring',
|
||||
]);
|
||||
expect(links[0]).toHaveAttribute('aria-current', 'page');
|
||||
expect(links[1]).not.toHaveAttribute('aria-current');
|
||||
});
|
||||
|
||||
it('laat lege kolommen weg', async () => {
|
||||
await renderFooter({
|
||||
...siteContent,
|
||||
socials: [{ platform: 'facebook', href: '' }],
|
||||
email: { user: '', domain: 'andreaslop.nl' },
|
||||
});
|
||||
expect(screen.queryByRole('heading', { name: 'Socials' })).toBeNull();
|
||||
expect(screen.queryByRole('heading', { name: 'Contact' })).toBeNull();
|
||||
expect(screen.queryByTestId('footer-email-link')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,154 @@
|
||||
import {
|
||||
Box,
|
||||
chakra,
|
||||
Container,
|
||||
Flex,
|
||||
Grid,
|
||||
Image,
|
||||
Text,
|
||||
VisuallyHidden,
|
||||
} from '@chakra-ui/react';
|
||||
import socialPlatforms from '@/content/socialPlatforms';
|
||||
import type { SiteContent } from '@/content/types';
|
||||
import { copyrightLine } from '@/lib/copyrightLine';
|
||||
import { emailAddress } from '@/lib/emailAddress';
|
||||
import { visibleSocials } from '@/lib/visibleSocials';
|
||||
import { footerNav } from '@/navigation';
|
||||
import RouterLink from '../RouterLink';
|
||||
import FooterColumn from './FooterColumn';
|
||||
import FooterLink from './FooterLink';
|
||||
|
||||
// Images
|
||||
import logoDark from '../../assets/logo-dark.png';
|
||||
|
||||
type FooterProps = {
|
||||
content: SiteContent;
|
||||
};
|
||||
|
||||
// Footer uit het design (FR-05): merk, socials en contact, met daaronder de
|
||||
// copyright en het footermenu. Een lege kolom valt weg (BR-FOOT-01).
|
||||
export default function Footer({ content }: FooterProps) {
|
||||
const socials = visibleSocials(content.socials);
|
||||
// Pas hier samengevoegd, zodat het adres nergens letterlijk staat
|
||||
const email = emailAddress(content.email);
|
||||
const year = new Date().getFullYear();
|
||||
|
||||
return (
|
||||
<Box
|
||||
as="footer"
|
||||
bg="paper.alt"
|
||||
borderTopWidth="1px"
|
||||
borderTopColor="line"
|
||||
pt="clamp(3.5rem, 7vw, 6rem)"
|
||||
>
|
||||
<Container>
|
||||
<Grid
|
||||
templateColumns={{
|
||||
base: '1fr',
|
||||
md: 'repeat(2, 1fr)',
|
||||
lg: '1.2fr 1fr 1fr',
|
||||
}}
|
||||
gap="clamp(2rem, 5vw, 4rem)"
|
||||
pb="clamp(2.5rem, 5vw, 4rem)"
|
||||
>
|
||||
{/* Merk: op mobiel gecentreerd onder elkaar, vanaf tablet
|
||||
het logo met de tekst ernaast */}
|
||||
<Flex
|
||||
direction={{ base: 'column', md: 'row' }}
|
||||
alignItems="center"
|
||||
alignSelf="start"
|
||||
gap={5}
|
||||
textAlign={{ base: 'center', md: 'start' }}
|
||||
>
|
||||
<Image
|
||||
src={logoDark}
|
||||
alt="Andrea Slop Fotografie"
|
||||
htmlWidth={500}
|
||||
htmlHeight={500}
|
||||
w={{ base: '150px', md: '110px' }}
|
||||
h="auto"
|
||||
flexShrink={0}
|
||||
loading="lazy"
|
||||
/>
|
||||
{/* Regelafbrekingen uit de content blijven staan */}
|
||||
<Text color="ink.soft" whiteSpace="pre-line">
|
||||
{content.footerIntro}
|
||||
</Text>
|
||||
</Flex>
|
||||
|
||||
{socials.length > 0 && (
|
||||
<FooterColumn title="Socials">
|
||||
{socials.map((social) => (
|
||||
<chakra.li key={social.platform}>
|
||||
<FooterLink
|
||||
href={social.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
data-testid={`footer-social-${social.platform}`}
|
||||
>
|
||||
{/* Spatie buiten de verborgen tekst, anders
|
||||
valt hij weg uit de voorgelezen naam */}
|
||||
{socialPlatforms[social.platform].name}{' '}
|
||||
<VisuallyHidden>
|
||||
(opent in nieuw tabblad)
|
||||
</VisuallyHidden>
|
||||
</FooterLink>
|
||||
</chakra.li>
|
||||
))}
|
||||
</FooterColumn>
|
||||
)}
|
||||
|
||||
{email && (
|
||||
<FooterColumn title="Contact">
|
||||
<chakra.li>
|
||||
<FooterLink
|
||||
href={`mailto:${email}`}
|
||||
data-testid="footer-email-link"
|
||||
>
|
||||
{email}
|
||||
</FooterLink>
|
||||
</chakra.li>
|
||||
</FooterColumn>
|
||||
)}
|
||||
</Grid>
|
||||
|
||||
<Flex
|
||||
direction={{ base: 'column', md: 'row' }}
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
gap={{ base: 2, md: 6 }}
|
||||
py={6}
|
||||
borderTopWidth="1px"
|
||||
borderTopColor="line"
|
||||
textAlign={{ base: 'center', md: 'start' }}
|
||||
>
|
||||
<Text fontSize="sm" color="ink.soft">
|
||||
{copyrightLine(year)}
|
||||
</Text>
|
||||
<chakra.nav aria-label="Footermenu">
|
||||
<Flex
|
||||
as="ul"
|
||||
listStyleType="none"
|
||||
wrap="wrap"
|
||||
justifyContent="center"
|
||||
columnGap={6}
|
||||
>
|
||||
{footerNav.map((item) => (
|
||||
<chakra.li key={item.to}>
|
||||
<FooterLink asChild>
|
||||
<RouterLink
|
||||
to={item.to}
|
||||
data-testid={`footer-nav-${item.to.slice(1)}`}
|
||||
>
|
||||
{item.label}
|
||||
</RouterLink>
|
||||
</FooterLink>
|
||||
</chakra.li>
|
||||
))}
|
||||
</Flex>
|
||||
</chakra.nav>
|
||||
</Flex>
|
||||
</Container>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, Heading, Stack } from '@chakra-ui/react';
|
||||
|
||||
type FooterColumnProps = {
|
||||
title: string;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
// Kolom in de footer: kopje als label, daaronder een lijst. De kop is een h2,
|
||||
// want de kolommen zijn hoofdsecties van de pagina (BR-SEO-09).
|
||||
export default function FooterColumn({ title, children }: FooterColumnProps) {
|
||||
return (
|
||||
<Box>
|
||||
<Heading
|
||||
as="h2"
|
||||
// Mobiele schermlezers lezen de CSS-hoofdletters ("SOCIALS") als
|
||||
// afkorting; het label geeft ze het woord in gewone schrijfwijze
|
||||
aria-label={title}
|
||||
textStyle="eyebrow"
|
||||
fontFamily="body"
|
||||
color="ink.soft"
|
||||
mb={{ base: 2, lg: 4 }}
|
||||
>
|
||||
{title}
|
||||
</Heading>
|
||||
<Stack as="ul" listStyleType="none" gap={{ base: 0, lg: 2 }}>
|
||||
{children}
|
||||
</Stack>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { Link, type LinkProps } from '@chakra-ui/react';
|
||||
|
||||
// Link in de footer: de rustige `subtle`-stijl, en op touch minimaal 44px
|
||||
// hoog als klikdoel (BR-RWD-04)
|
||||
export default function FooterLink(props: LinkProps) {
|
||||
return (
|
||||
<Link
|
||||
variant="subtle"
|
||||
minH={{ base: '44px', lg: 'auto' }}
|
||||
fontSize="sm"
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { fireEvent, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import heroContent from '@/content/heroContent';
|
||||
import siteContent from '@/content/siteContent';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import Hero from './Hero';
|
||||
|
||||
describe('Hero', () => {
|
||||
it('toont alleen geldige socials, met melding over het nieuwe tabblad', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<Hero
|
||||
content={heroContent}
|
||||
socials={[
|
||||
...siteContent.socials,
|
||||
{ platform: 'facebook', href: 'javascript:alert(1)' },
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
const links = screen.getAllByRole('link', {
|
||||
name: /opent in nieuw tabblad/,
|
||||
});
|
||||
expect(links).toHaveLength(2);
|
||||
expect(links[0]).toHaveAccessibleName(
|
||||
'Facebook (opent in nieuw tabblad)',
|
||||
);
|
||||
expect(links[0]).toHaveAttribute('rel', 'noopener noreferrer');
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('laadt eerst de eerste foto, daarna alleen de volgende en vorige', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<Hero content={heroContent} socials={siteContent.socials} />,
|
||||
);
|
||||
const sources = () =>
|
||||
[...container.querySelectorAll('img')].map((img) =>
|
||||
img.getAttribute('src'),
|
||||
);
|
||||
const slide = (i: number) => heroContent.slides[i].src;
|
||||
const last = heroContent.slides.length - 1;
|
||||
|
||||
expect(sources()).toEqual([slide(0)]);
|
||||
fireEvent.load(container.querySelector('img')!);
|
||||
// Vanaf de eerste foto is de vorige de laatste
|
||||
await waitFor(() =>
|
||||
expect(sources()).toEqual([slide(0), slide(1), slide(last)]),
|
||||
);
|
||||
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Volgende foto' }),
|
||||
);
|
||||
expect(sources()).toEqual([slide(0), slide(1), slide(2)]);
|
||||
});
|
||||
|
||||
it('heeft pijlen met een toegankelijke naam', async () => {
|
||||
await renderWithProviders(
|
||||
<Hero content={heroContent} socials={siteContent.socials} />,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Vorige foto' }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Volgende foto' }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -1,20 +1,35 @@
|
||||
import { useState } from 'react';
|
||||
import { Box, chakra, Container, Heading, Image } from '@chakra-ui/react';
|
||||
import LinkButton from '../LinkButton';
|
||||
import HeroArrows from './HeroArrows';
|
||||
import HeroSocials from './HeroSocials';
|
||||
import useHeroSlider from './useHeroSlider';
|
||||
import type { HeroContent } from './types';
|
||||
import type { HeroContent, SocialLink } from '@/content/types';
|
||||
import { slidesToLoad } from '@/lib/slidesToLoad';
|
||||
|
||||
const SLIDE_DURATION = '6s';
|
||||
|
||||
type HeroProps = {
|
||||
content: HeroContent;
|
||||
socials: SocialLink[];
|
||||
};
|
||||
|
||||
export default function Hero({ content }: HeroProps) {
|
||||
const { title, tagline, cta, slides, socials } = content;
|
||||
export default function Hero({ content, socials }: HeroProps) {
|
||||
const { title, tagline, cta, slides } = content;
|
||||
const { active, reducedMotion, autoplay, paused, next, prev, handlers } =
|
||||
useHeroSlider(slides.length);
|
||||
// De slides liggen op elkaar in beeld, dus loading="lazy" stelt niets uit.
|
||||
// Eerst alleen de actieve foto; zodra die binnen en getekend is (twee
|
||||
// frames later, dus na de eerste paint) ook de volgende en de vorige.
|
||||
// Verder weg laden we pas als de slider in de buurt komt (BR-HERO-01).
|
||||
const [firstPainted, setFirstPainted] = useState(false);
|
||||
const onFirstLoaded = () =>
|
||||
requestAnimationFrame(() =>
|
||||
requestAnimationFrame(() => setFirstPainted(true)),
|
||||
);
|
||||
const loaded = firstPainted
|
||||
? slidesToLoad(active, slides.length)
|
||||
: [active];
|
||||
|
||||
return (
|
||||
<Box
|
||||
@@ -48,21 +63,28 @@ export default function Hero({ content }: HeroProps) {
|
||||
transitionDuration="fade"
|
||||
transitionTimingFunction="smooth"
|
||||
>
|
||||
<Image
|
||||
src={slide.src}
|
||||
alt={slide.alt}
|
||||
fetchPriority={i === 0 ? 'high' : undefined}
|
||||
loading={i === 0 ? undefined : 'lazy'}
|
||||
w="100%"
|
||||
h="100%"
|
||||
objectFit="cover"
|
||||
transform={
|
||||
reducedMotion || i === active
|
||||
? 'scale(1)'
|
||||
: 'scale(1.06)'
|
||||
}
|
||||
transition="transform 9s linear"
|
||||
/>
|
||||
{loaded.includes(i) && (
|
||||
<Image
|
||||
src={slide.src}
|
||||
alt={slide.alt}
|
||||
fetchPriority={i === 0 ? 'high' : undefined}
|
||||
onLoad={
|
||||
firstPainted ? undefined : onFirstLoaded
|
||||
}
|
||||
onError={
|
||||
firstPainted ? undefined : onFirstLoaded
|
||||
}
|
||||
w="100%"
|
||||
h="100%"
|
||||
objectFit="cover"
|
||||
transform={
|
||||
reducedMotion || i === active
|
||||
? 'scale(1)'
|
||||
: 'scale(1.06)'
|
||||
}
|
||||
transition="transform 9s linear"
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chakra } from '@chakra-ui/react';
|
||||
import { chakra, useRecipe } from '@chakra-ui/react';
|
||||
import { Icon } from '@iconify/react/offline';
|
||||
import leftOutlined from '@iconify-icons/ant-design/left-outlined';
|
||||
import rightOutlined from '@iconify-icons/ant-design/right-outlined';
|
||||
@@ -12,10 +12,20 @@ type HeroArrowsProps = {
|
||||
export default function HeroArrows({ onPrev, onNext }: HeroArrowsProps) {
|
||||
return (
|
||||
<>
|
||||
<ArrowButton side="left" aria-label="Vorige foto" onClick={onPrev}>
|
||||
<ArrowButton
|
||||
side="left"
|
||||
aria-label="Vorige foto"
|
||||
data-testid="hero-prev-button"
|
||||
onClick={onPrev}
|
||||
>
|
||||
<Icon icon={leftOutlined} aria-hidden />
|
||||
</ArrowButton>
|
||||
<ArrowButton side="right" aria-label="Volgende foto" onClick={onNext}>
|
||||
<ArrowButton
|
||||
side="right"
|
||||
aria-label="Volgende foto"
|
||||
data-testid="hero-next-button"
|
||||
onClick={onNext}
|
||||
>
|
||||
<Icon icon={rightOutlined} aria-hidden />
|
||||
</ArrowButton>
|
||||
</>
|
||||
@@ -29,26 +39,20 @@ type ArrowButtonProps = React.ComponentProps<typeof chakra.button> & {
|
||||
const ARROW_OFFSET = 'clamp(0.5rem, 3vw, 2.5rem)';
|
||||
|
||||
function ArrowButton({ side, ...props }: ArrowButtonProps) {
|
||||
// Doorzichtigheid, hover en witte focusring komen uit de iconControl-recipe
|
||||
const iconControl = useRecipe({ key: 'iconControl' });
|
||||
|
||||
return (
|
||||
<chakra.button
|
||||
type="button"
|
||||
css={iconControl()}
|
||||
position="absolute"
|
||||
top="50%"
|
||||
left={side === 'left' ? ARROW_OFFSET : undefined}
|
||||
right={side === 'right' ? ARROW_OFFSET : undefined}
|
||||
zIndex={2}
|
||||
transform="translateY(-50%)"
|
||||
display="flex"
|
||||
p={2}
|
||||
color="white"
|
||||
fontSize={{ base: '1.5rem', md: '2rem' }}
|
||||
cursor="pointer"
|
||||
opacity={0.6}
|
||||
transitionProperty="opacity"
|
||||
transitionDuration="interaction"
|
||||
transitionTimingFunction="smooth"
|
||||
_hover={{ opacity: 1 }}
|
||||
_focusVisible={{ opacity: 1, outline: '1px solid white', outlineOffset: '2px' }}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -1,48 +1,43 @@
|
||||
import { chakra, HStack } from '@chakra-ui/react';
|
||||
import { chakra, HStack, useRecipe } from '@chakra-ui/react';
|
||||
import { Icon } from '@iconify/react/offline';
|
||||
import socialPlatforms from './socialPlatforms';
|
||||
import type { HeroSocial } from './types';
|
||||
import socialPlatforms from '@/content/socialPlatforms';
|
||||
import type { SocialLink } from '@/content/types';
|
||||
import { visibleSocials } from '@/lib/visibleSocials';
|
||||
|
||||
type HeroSocialsProps = {
|
||||
socials: HeroSocial[];
|
||||
socials: SocialLink[];
|
||||
};
|
||||
|
||||
// Socials linksonder, naast elkaar
|
||||
export default function HeroSocials({ socials }: HeroSocialsProps) {
|
||||
const iconControl = useRecipe({ key: 'iconControl' });
|
||||
|
||||
return (
|
||||
<HStack
|
||||
position="absolute"
|
||||
left="gutter"
|
||||
bottom={{ base: 6, md: 10 }}
|
||||
zIndex={2}
|
||||
gap={5}
|
||||
color="white"
|
||||
gap={2}
|
||||
fontSize="1.5rem"
|
||||
>
|
||||
{socials
|
||||
.filter((social) => social.href)
|
||||
.map((social) => {
|
||||
const { name, icon } = socialPlatforms[social.platform];
|
||||
{visibleSocials(socials).map((social) => {
|
||||
const { name, icon } = socialPlatforms[social.platform];
|
||||
|
||||
return (
|
||||
<chakra.a
|
||||
key={social.platform}
|
||||
href={social.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={name}
|
||||
display="flex"
|
||||
opacity={0.6}
|
||||
transitionProperty="opacity"
|
||||
transitionDuration="interaction"
|
||||
transitionTimingFunction="smooth"
|
||||
_hover={{ opacity: 1 }}
|
||||
_focusVisible={{ opacity: 1 }}
|
||||
>
|
||||
<Icon icon={icon} aria-hidden />
|
||||
</chakra.a>
|
||||
);
|
||||
})}
|
||||
return (
|
||||
<chakra.a
|
||||
key={social.platform}
|
||||
href={social.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={`${name} (opent in nieuw tabblad)`}
|
||||
data-testid={`hero-social-${social.platform}`}
|
||||
css={iconControl()}
|
||||
>
|
||||
<Icon icon={icon} aria-hidden />
|
||||
</chakra.a>
|
||||
);
|
||||
})}
|
||||
</HStack>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import type { HeroContent } from './types';
|
||||
|
||||
// Images
|
||||
import hero1 from '../../assets/hero-1.jpg';
|
||||
import hero2 from '../../assets/hero-2.jpg';
|
||||
import newborn from '../../assets/newborn.jpg';
|
||||
import hero4 from '../../assets/hero-4.jpg';
|
||||
import hero5 from '../../assets/hero-5.jpg';
|
||||
import hero6 from '../../assets/hero-6.jpg';
|
||||
|
||||
// Statische content tot de CMS-API er is. Daarna komt dit object uit de API.
|
||||
const heroContent: HeroContent = {
|
||||
title: 'Andrea Slop',
|
||||
tagline: 'Lifestyle fotograaf · Huizen',
|
||||
cta: { label: 'Lees meer', to: '/over-mij' },
|
||||
slides: [
|
||||
{ id: 'hero-1', src: hero1, alt: 'Lifestyle fotografie van Andrea Slop' },
|
||||
{ id: 'hero-2', src: hero2, alt: 'Zwangerschapsshoot in de buitenlucht' },
|
||||
{ id: 'newborn', src: newborn, alt: 'Newbornshoot van een pasgeboren baby' },
|
||||
{ id: 'hero-4', src: hero4, alt: 'Spontaan portret buiten' },
|
||||
{ id: 'hero-5', src: hero5, alt: 'Natuurlijke lifestylefoto' },
|
||||
{ id: 'hero-6', src: hero6, alt: 'Portret in de natuur' },
|
||||
],
|
||||
socials: [
|
||||
{
|
||||
platform: 'facebook',
|
||||
href: 'https://www.facebook.com/andreaslopfotografie/',
|
||||
},
|
||||
{
|
||||
platform: 'instagram',
|
||||
href: 'https://www.instagram.com/andreaslopfotografie/',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default heroContent;
|
||||
@@ -1,30 +0,0 @@
|
||||
import type { SocialPlatform } from './socialPlatforms';
|
||||
|
||||
// Vorm van de hero-content. Deze types zijn bewust platte data (strings en
|
||||
// arrays) zodat ze later 1-op-1 uit de CMS-API kunnen komen.
|
||||
|
||||
export interface HeroSlide {
|
||||
id: string;
|
||||
src: string;
|
||||
alt: string;
|
||||
}
|
||||
|
||||
export interface HeroCta {
|
||||
label: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface HeroSocial {
|
||||
platform: SocialPlatform;
|
||||
href: string; // leeg = niet tonen
|
||||
}
|
||||
|
||||
export interface HeroContent {
|
||||
title: string;
|
||||
// Klein label in hoofdletters boven de titel: wat en waar, voor bezoekers
|
||||
// en zoekmachines (bv. "Lifestyle fotograaf · Huizen")
|
||||
tagline: string;
|
||||
cta: HeroCta;
|
||||
slides: HeroSlide[];
|
||||
socials: HeroSocial[];
|
||||
}
|
||||
@@ -12,15 +12,22 @@ export default function useHeroSlider(count: number) {
|
||||
const [hovered, setHovered] = useState(false);
|
||||
const [focused, setFocused] = useState(false);
|
||||
const [hidden, setHidden] = useState(() => document.hidden);
|
||||
const [reducedMotion] = useMediaQuery(['(prefers-reduced-motion: reduce)'], {
|
||||
ssr: false,
|
||||
});
|
||||
const [reducedMotion] = useMediaQuery(
|
||||
['(prefers-reduced-motion: reduce)'],
|
||||
{
|
||||
ssr: false,
|
||||
},
|
||||
);
|
||||
const touchStart = useRef<{ x: number; y: number } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const onVisibilityChange = () => setHidden(document.hidden);
|
||||
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||
return () => document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||
return () =>
|
||||
document.removeEventListener(
|
||||
'visibilitychange',
|
||||
onVisibilityChange,
|
||||
);
|
||||
}, []);
|
||||
|
||||
// Als de API minder slides teruggeeft dan de huidige index, begin vooraan.
|
||||
@@ -65,7 +72,11 @@ export default function useHeroSlider(count: number) {
|
||||
const dy = touch.clientY - start.y;
|
||||
|
||||
// Horizontaal genoeg, en niet bedoeld als verticaal scrollen
|
||||
if (Math.abs(dx) < SWIPE_THRESHOLD || Math.abs(dx) < Math.abs(dy)) return;
|
||||
if (
|
||||
Math.abs(dx) < SWIPE_THRESHOLD ||
|
||||
Math.abs(dx) < Math.abs(dy)
|
||||
)
|
||||
return;
|
||||
if (dx < 0) next();
|
||||
else prev();
|
||||
},
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { chakra, useRecipe, type RecipeVariantProps } from '@chakra-ui/react';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import { useRecipe, type RecipeVariantProps } from '@chakra-ui/react';
|
||||
import type linkButtonRecipe from '../recipes/linkButton';
|
||||
import RouterLink from './RouterLink';
|
||||
|
||||
const ChakraLink = chakra(Link);
|
||||
|
||||
type LinkButtonProps = React.ComponentProps<typeof ChakraLink> &
|
||||
type LinkButtonProps = React.ComponentProps<typeof RouterLink> &
|
||||
RecipeVariantProps<typeof linkButtonRecipe>;
|
||||
|
||||
// Router-link in de knopstijl uit het design. Styling komt uit de
|
||||
@@ -13,5 +11,5 @@ export default function LinkButton(props: LinkButtonProps) {
|
||||
const recipe = useRecipe({ key: 'linkButton' });
|
||||
const [variantProps, rest] = recipe.splitVariantProps(props);
|
||||
|
||||
return <ChakraLink css={recipe(variantProps)} {...rest} />;
|
||||
return <RouterLink css={recipe(variantProps)} {...rest} />;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Box, chakra, Stack } from '@chakra-ui/react';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import navItems from './navItems';
|
||||
|
||||
const ChakraLink = chakra(Link);
|
||||
import { Box, Stack } from '@chakra-ui/react';
|
||||
import { mainNav } from '@/navigation';
|
||||
import RouterLink from '../RouterLink';
|
||||
|
||||
type MobileNavProps = {
|
||||
id: string;
|
||||
@@ -37,7 +35,7 @@ export default function MobileNav({ id, open, onClose }: MobileNavProps) {
|
||||
insetX={0}
|
||||
bottom={0}
|
||||
// Net onder de balk, zodat de schaduw van de balk erover valt
|
||||
zIndex="calc({zIndex.docked} - 1)"
|
||||
zIndex="mobileNav"
|
||||
display={{ base: 'flex', lg: 'none' }}
|
||||
flexDirection="column"
|
||||
justifyContent="center"
|
||||
@@ -54,9 +52,9 @@ export default function MobileNav({ id, open, onClose }: MobileNavProps) {
|
||||
>
|
||||
<nav aria-label="Mobiel menu">
|
||||
<Stack as="ul" gap={5} listStyleType="none">
|
||||
{navItems.map((item) => (
|
||||
{mainNav.map((item) => (
|
||||
<li key={item.to}>
|
||||
<ChakraLink
|
||||
<RouterLink
|
||||
to={item.to}
|
||||
onClick={onClose}
|
||||
display="block"
|
||||
@@ -66,7 +64,7 @@ export default function MobileNav({ id, open, onClose }: MobileNavProps) {
|
||||
_currentPage={{ color: 'accent' }}
|
||||
>
|
||||
{item.label}
|
||||
</ChakraLink>
|
||||
</RouterLink>
|
||||
</li>
|
||||
))}
|
||||
</Stack>
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { chakra } from '@chakra-ui/react';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import RouterLink from '../RouterLink';
|
||||
|
||||
const ChakraLink = chakra(Link);
|
||||
|
||||
type NavLinkProps = React.ComponentProps<typeof ChakraLink>;
|
||||
type NavLinkProps = React.ComponentProps<typeof RouterLink>;
|
||||
|
||||
export default function NavLink({ children, ...props }: NavLinkProps) {
|
||||
return (
|
||||
<ChakraLink
|
||||
<RouterLink
|
||||
textStyle="eyebrow"
|
||||
fontWeight="300"
|
||||
position="relative"
|
||||
@@ -38,6 +35,6 @@ export default function NavLink({ children, ...props }: NavLinkProps) {
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</ChakraLink>
|
||||
</RouterLink>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import NavigationBar from './NavigationBar';
|
||||
|
||||
describe('NavigationBar', () => {
|
||||
it('heeft het logo als link naar home', async () => {
|
||||
await renderWithProviders(<NavigationBar />, { path: '/portfolio' });
|
||||
expect(
|
||||
screen.getByRole('link', {
|
||||
name: 'Andrea Slop Fotografie, naar de homepage',
|
||||
}),
|
||||
).toHaveAttribute('href', '/');
|
||||
});
|
||||
|
||||
it('toont het hoofdmenu in de vaste volgorde', async () => {
|
||||
const { container } = await renderWithProviders(<NavigationBar />);
|
||||
const nav = screen.getByRole('navigation', { name: 'Hoofdmenu' });
|
||||
expect(
|
||||
within(nav)
|
||||
.getAllByRole('link', { hidden: true })
|
||||
.map((link) => link.textContent),
|
||||
).toEqual([
|
||||
'Home',
|
||||
'Over mij',
|
||||
'Portfolio',
|
||||
'Soorten fotoshoots',
|
||||
'Contact',
|
||||
]);
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('heeft een menuknop met een toegankelijke naam', async () => {
|
||||
await renderWithProviders(<NavigationBar />);
|
||||
expect(screen.getByTestId('nav-menu-toggle')).toHaveAccessibleName(
|
||||
'Menu openen',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -3,13 +3,13 @@ import {
|
||||
HStack,
|
||||
chakra,
|
||||
Image,
|
||||
Box,
|
||||
Container,
|
||||
useBreakpointValue,
|
||||
} from '@chakra-ui/react';
|
||||
import NavLink from './NavLink';
|
||||
import MobileNav from './MobileNav';
|
||||
import navItems from './navItems';
|
||||
import { mainNav } from '@/navigation';
|
||||
import RouterLink from '../RouterLink';
|
||||
import useScrolledPast from '@/hooks/useScrolledPast';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useRouterState } from '@tanstack/react-router';
|
||||
@@ -19,7 +19,7 @@ import logoLight from '../../assets/logo-light.png';
|
||||
import logoDark from '../../assets/logo-dark.png';
|
||||
|
||||
export default function NavigationBar() {
|
||||
let [open, setOpen] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
const closeMenu = useCallback(() => setOpen(false), []);
|
||||
|
||||
// Het mobiele menu bestaat alleen onder lg; wordt het scherm breder, dan
|
||||
@@ -47,7 +47,7 @@ export default function NavigationBar() {
|
||||
position="fixed"
|
||||
top={0}
|
||||
insetX={0}
|
||||
zIndex="docked"
|
||||
zIndex="header"
|
||||
// Zelfde hoogte als waar de hero-content onder begint; kleiner na scrollen
|
||||
h={pastHero ? 'header.sticky' : 'header'}
|
||||
display="flex"
|
||||
@@ -69,7 +69,11 @@ export default function NavigationBar() {
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
>
|
||||
<Box
|
||||
<RouterLink
|
||||
to="/"
|
||||
aria-label="Andrea Slop Fotografie, naar de homepage"
|
||||
data-testid="nav-logo-link"
|
||||
display="block"
|
||||
flexBasis="auto"
|
||||
flexGrow={1}
|
||||
flexShrink={0}
|
||||
@@ -84,17 +88,22 @@ export default function NavigationBar() {
|
||||
transitionTimingFunction="smooth"
|
||||
>
|
||||
{/* Twee logo's, zodat de kleur per schermbreedte kan wisselen */}
|
||||
{/* De link heeft de naam; de logo's zelf zijn decoratief */}
|
||||
<Image
|
||||
src={logoDark}
|
||||
alt="Andrea Slop Fotografie"
|
||||
alt=""
|
||||
htmlWidth={500}
|
||||
htmlHeight={500}
|
||||
display={overlay('block', 'none')}
|
||||
/>
|
||||
<Image
|
||||
src={logoLight}
|
||||
alt="Andrea Slop Fotografie"
|
||||
alt=""
|
||||
htmlWidth={500}
|
||||
htmlHeight={500}
|
||||
display={overlay('none', 'block')}
|
||||
/>
|
||||
</Box>
|
||||
</RouterLink>
|
||||
<chakra.nav
|
||||
aria-label="Hoofdmenu"
|
||||
flexBasis="100%"
|
||||
@@ -109,7 +118,7 @@ export default function NavigationBar() {
|
||||
// Op mobiel staan de links in het hamburgermenu
|
||||
display={{ base: 'none', lg: 'flex' }}
|
||||
>
|
||||
{navItems.map((item) => (
|
||||
{mainNav.map((item) => (
|
||||
<chakra.li key={item.to}>
|
||||
<NavLink to={item.to}>
|
||||
{item.label}
|
||||
@@ -135,15 +144,17 @@ export default function NavigationBar() {
|
||||
data-open={menuOpen || undefined}
|
||||
// Op desktop opent deze knop straks het info-menu (side area)
|
||||
display={{ base: 'block', lg: 'none' }}
|
||||
data-testid="nav-menu-toggle"
|
||||
position="relative"
|
||||
w="32px"
|
||||
h="32px"
|
||||
// 44px: minimaal klikdoel op touch (BR-RWD-04)
|
||||
w="44px"
|
||||
h="44px"
|
||||
cursor="pointer"
|
||||
zIndex="modal"
|
||||
zIndex="menuToggle"
|
||||
css={{
|
||||
'& > span': {
|
||||
position: 'absolute',
|
||||
left: '4px',
|
||||
left: '10px',
|
||||
width: '24px',
|
||||
height: '2px',
|
||||
bg: 'currentColor',
|
||||
@@ -151,22 +162,22 @@ export default function NavigationBar() {
|
||||
transition:
|
||||
'transform 0.3s ease, opacity 0.2s ease, top 0.3s ease',
|
||||
},
|
||||
'& > span:nth-of-type(1)': { top: '9px' },
|
||||
'& > span:nth-of-type(2)': { top: '15px' },
|
||||
'& > span:nth-of-type(3)': { top: '21px' },
|
||||
'& > span:nth-of-type(1)': { top: '15px' },
|
||||
'& > span:nth-of-type(2)': { top: '21px' },
|
||||
'& > span:nth-of-type(3)': { top: '27px' },
|
||||
|
||||
// open kruisje
|
||||
'&[data-open] > span:nth-of-type(1)': {
|
||||
top: '15px',
|
||||
top: '21px',
|
||||
transform: 'rotate(45deg)',
|
||||
},
|
||||
'&[data-open] > span:nth-of-type(2)': {
|
||||
opacity: 0,
|
||||
top: '15px',
|
||||
top: '21px',
|
||||
transform: 'rotate(45deg)',
|
||||
},
|
||||
'&[data-open] > span:nth-of-type(3)': {
|
||||
top: '15px',
|
||||
top: '21px',
|
||||
transform: 'rotate(-45deg)',
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
// Menu-items, gedeeld door de desktopnavigatie en het mobiele menu
|
||||
const navItems = [
|
||||
{ to: '/', label: 'Home' },
|
||||
{ to: '/over-mij', label: 'Over mij' },
|
||||
] as const;
|
||||
|
||||
export default navItems;
|
||||
@@ -0,0 +1,31 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import PageIntro from './PageIntro';
|
||||
|
||||
describe('PageIntro', () => {
|
||||
it('toont label, de enige h1 en de intro', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<PageIntro eyebrow="Werk" title="Portfolio">
|
||||
Deze pagina is nog in de maak.
|
||||
</PageIntro>,
|
||||
);
|
||||
expect(screen.getAllByRole('heading', { level: 1 })).toHaveLength(1);
|
||||
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
|
||||
'Portfolio',
|
||||
);
|
||||
expect(screen.getByText('Werk')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText('Deze pagina is nog in de maak.'),
|
||||
).toBeInTheDocument();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('werkt zonder label en intro', async () => {
|
||||
await renderWithProviders(<PageIntro title="Contact" />);
|
||||
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
|
||||
'Contact',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Container, Heading, Text } from '@chakra-ui/react';
|
||||
|
||||
type PageIntroProps = {
|
||||
title: string;
|
||||
eyebrow?: string;
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
// Bovenste blok van een gewone pagina (.page-head in het design): label,
|
||||
// de enige h1 van de pagina en een korte intro
|
||||
export default function PageIntro({
|
||||
title,
|
||||
eyebrow,
|
||||
children,
|
||||
}: PageIntroProps) {
|
||||
return (
|
||||
<Container
|
||||
as="section"
|
||||
pt="pageTop"
|
||||
pb={{ base: 8, md: 12, lg: 16 }}
|
||||
textAlign="center"
|
||||
>
|
||||
{eyebrow && (
|
||||
// accent.deep i.p.v. accent uit het design: haalt 4.5:1 (NFR-01)
|
||||
<Text textStyle="eyebrow" color="accent.deep" mb={4}>
|
||||
{eyebrow}
|
||||
</Text>
|
||||
)}
|
||||
<Heading as="h1" textStyle="pageTitle" mb={4}>
|
||||
{title}
|
||||
</Heading>
|
||||
{children && (
|
||||
<Text color="ink.soft" maxW="680px" mx="auto">
|
||||
{children}
|
||||
</Text>
|
||||
)}
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { chakra } from '@chakra-ui/react';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
|
||||
// De router-link met Chakra-styleprops. Eén gedeelde versie, zodat niet elk
|
||||
// component zijn eigen chakra(Link) maakt.
|
||||
const RouterLink = chakra(Link);
|
||||
|
||||
export default RouterLink;
|
||||
@@ -0,0 +1,55 @@
|
||||
import { useEffect } from 'react';
|
||||
import { chakra, useRecipe } from '@chakra-ui/react';
|
||||
import { useRouter, type ErrorComponentProps } from '@tanstack/react-router';
|
||||
import LinkButton from '../LinkButton';
|
||||
import StatusPage from './StatusPage';
|
||||
|
||||
// Algemene foutpagina (FR-10). Toont nooit de foutmelding zelf; die gaat
|
||||
// alleen naar de console (BR-ERR-02/03).
|
||||
export default function ErrorPage({ error, reset }: ErrorComponentProps) {
|
||||
const router = useRouter();
|
||||
const buttonRecipe = useRecipe({ key: 'linkButton' });
|
||||
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
// Foutgrens resetten en de route opnieuw laden (BR-ERR-04)
|
||||
const retry = () => {
|
||||
reset();
|
||||
router.invalidate();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<title>Er ging iets mis | Andrea Slop Fotografie</title>
|
||||
<meta name="robots" content="noindex" />
|
||||
<StatusPage
|
||||
title="Er ging iets mis"
|
||||
actions={
|
||||
<>
|
||||
<chakra.button
|
||||
type="button"
|
||||
onClick={retry}
|
||||
css={buttonRecipe({ variant: 'accent' })}
|
||||
cursor="pointer"
|
||||
data-testid="error-page-retry-button"
|
||||
>
|
||||
Opnieuw proberen
|
||||
</chakra.button>
|
||||
<LinkButton
|
||||
to="/"
|
||||
variant="outline"
|
||||
data-testid="error-page-home-link"
|
||||
>
|
||||
Terug naar home
|
||||
</LinkButton>
|
||||
</>
|
||||
}
|
||||
>
|
||||
Door een fout kan deze pagina nu niet worden getoond. Probeer
|
||||
het opnieuw of ga terug naar de homepage.
|
||||
</StatusPage>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import StatusPage from './StatusPage';
|
||||
|
||||
// Pagina voor een onbekende URL, binnen de shell (FR-09). Een globale
|
||||
// not-found heeft geen eigen route-head; React 19 zet <title> en <meta>
|
||||
// daarom zelf in <head> en haalt ze weer weg bij het verlaten (BR-404-02).
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<>
|
||||
<title>Pagina niet gevonden | Andrea Slop Fotografie</title>
|
||||
<meta name="robots" content="noindex" />
|
||||
<StatusPage title="Pagina niet gevonden">
|
||||
Deze pagina bestaat niet (meer). Misschien is de link verouderd
|
||||
of zit er een typfout in het adres.
|
||||
</StatusPage>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import ErrorPage from './ErrorPage';
|
||||
import NotFound from './NotFound';
|
||||
|
||||
describe('NotFound', () => {
|
||||
it('toont de 404-tekst met een link naar home', async () => {
|
||||
const { container } = await renderWithProviders(<NotFound />, {
|
||||
path: '/bestaat-niet',
|
||||
});
|
||||
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
|
||||
'Pagina niet gevonden',
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Terug naar home' }),
|
||||
).toHaveAttribute('href', '/');
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('zet een eigen titel en noindex in de head', async () => {
|
||||
await renderWithProviders(<NotFound />, { path: '/bestaat-niet' });
|
||||
expect(document.title).toBe(
|
||||
'Pagina niet gevonden | Andrea Slop Fotografie',
|
||||
);
|
||||
expect(
|
||||
document.head.querySelector('meta[name="robots"]'),
|
||||
).toHaveAttribute('content', 'noindex');
|
||||
});
|
||||
});
|
||||
|
||||
describe('ErrorPage', () => {
|
||||
const error = new Error('Geheime interne fout in de database');
|
||||
|
||||
const renderError = async () => {
|
||||
const reset = vi.fn();
|
||||
const consoleError = vi
|
||||
.spyOn(console, 'error')
|
||||
.mockImplementation(() => {});
|
||||
const result = await renderWithProviders(
|
||||
<ErrorPage error={error} reset={reset} />,
|
||||
);
|
||||
return { ...result, reset, consoleError };
|
||||
};
|
||||
|
||||
it('toont een algemene melding zonder foutdetails', async () => {
|
||||
const { container } = await renderError();
|
||||
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
|
||||
'Er ging iets mis',
|
||||
);
|
||||
expect(container).not.toHaveTextContent('Geheime interne fout');
|
||||
expect(container.innerHTML).not.toContain('database');
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('logt de fout precies een keer', async () => {
|
||||
const { consoleError } = await renderError();
|
||||
expect(consoleError).toHaveBeenCalledTimes(1);
|
||||
expect(consoleError).toHaveBeenCalledWith(error);
|
||||
});
|
||||
|
||||
it('opnieuw proberen reset de foutgrens en laadt de route opnieuw', async () => {
|
||||
const { reset, router } = await renderError();
|
||||
const invalidate = vi.spyOn(router, 'invalidate');
|
||||
await userEvent.click(
|
||||
screen.getByRole('button', { name: 'Opnieuw proberen' }),
|
||||
);
|
||||
expect(reset).toHaveBeenCalledTimes(1);
|
||||
expect(invalidate).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('biedt een link naar home en zet noindex', async () => {
|
||||
await renderError();
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Terug naar home' }),
|
||||
).toHaveAttribute('href', '/');
|
||||
expect(document.title).toBe(
|
||||
'Er ging iets mis | Andrea Slop Fotografie',
|
||||
);
|
||||
expect(
|
||||
document.head.querySelector('meta[name="robots"]'),
|
||||
).toHaveAttribute('content', 'noindex');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Container, Flex, Heading, Text } from '@chakra-ui/react';
|
||||
import LinkButton from '../LinkButton';
|
||||
|
||||
type StatusPageProps = {
|
||||
title: string;
|
||||
children: ReactNode;
|
||||
// Standaard één knop terug naar home
|
||||
actions?: ReactNode;
|
||||
};
|
||||
|
||||
// Gedeelde opmaak van de 404- en de foutpagina
|
||||
export default function StatusPage({
|
||||
title,
|
||||
children,
|
||||
actions,
|
||||
}: StatusPageProps) {
|
||||
return (
|
||||
<Container
|
||||
as="section"
|
||||
maxW="2xl"
|
||||
pt="pageTop"
|
||||
pb={{ base: 16, md: 24 }}
|
||||
textAlign="center"
|
||||
>
|
||||
<Heading as="h1" textStyle="pageTitle" mb={4}>
|
||||
{title}
|
||||
</Heading>
|
||||
<Text color="ink.soft" mb={8}>
|
||||
{children}
|
||||
</Text>
|
||||
<Flex gap={4} justifyContent="center" wrap="wrap">
|
||||
{actions ?? (
|
||||
<LinkButton to="/" data-testid="status-page-home-link">
|
||||
Terug naar home
|
||||
</LinkButton>
|
||||
)}
|
||||
</Flex>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { HeroContent } from './types';
|
||||
|
||||
// Images
|
||||
import hero1 from '../assets/hero-1.jpg';
|
||||
import hero2 from '../assets/hero-2.jpg';
|
||||
import hero3 from '../assets/hero-3.jpg';
|
||||
import hero4 from '../assets/hero-4.jpg';
|
||||
import hero5 from '../assets/hero-5.jpg';
|
||||
import hero6 from '../assets/hero-6.jpg';
|
||||
import hero7 from '../assets/hero-7.jpg';
|
||||
import hero8 from '../assets/hero-8.jpg';
|
||||
|
||||
// Statische content tot de CMS-API er is. Daarna komt dit object uit de API.
|
||||
const heroContent: HeroContent = {
|
||||
title: 'Andrea Slop',
|
||||
tagline: 'Lifestyle fotograaf · Huizen',
|
||||
cta: { label: 'Lees meer', to: '/over-mij' },
|
||||
slides: [
|
||||
{ id: 'hero-8', src: hero8, alt: 'Zwangerschapsfoto in de duinen' },
|
||||
{ id: 'hero-7', src: hero7, alt: 'Knusse newbornfoto met de familie' },
|
||||
{
|
||||
id: 'hero-1',
|
||||
src: hero1,
|
||||
alt: 'Lifestyle fotografie van Andrea Slop',
|
||||
},
|
||||
{
|
||||
id: 'hero-2',
|
||||
src: hero2,
|
||||
alt: 'Zwangerschapsshoot in de buitenlucht',
|
||||
},
|
||||
{
|
||||
id: 'hero-3',
|
||||
src: hero3,
|
||||
alt: 'Newbornshoot van een pasgeboren baby',
|
||||
},
|
||||
{ id: 'hero-4', src: hero4, alt: 'Spontaan portret buiten' },
|
||||
{ id: 'hero-5', src: hero5, alt: 'Natuurlijke lifestylefoto' },
|
||||
{ id: 'hero-6', src: hero6, alt: 'Portret in de natuur' },
|
||||
],
|
||||
};
|
||||
|
||||
export default heroContent;
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { SiteContent } from './types';
|
||||
|
||||
// Site-brede content tot de CMS-API er is. Daarna komt dit object uit de API.
|
||||
const siteContent: SiteContent = {
|
||||
// Elke zin op een eigen regel; de footer toont de regelafbreking
|
||||
footerIntro:
|
||||
'Lifestyle fotograaf uit Huizen.\nIk leg jouw mooiste momenten vast.',
|
||||
socials: [
|
||||
{
|
||||
platform: 'facebook',
|
||||
href: 'https://www.facebook.com/andreaslopfotografie/',
|
||||
},
|
||||
{
|
||||
platform: 'instagram',
|
||||
href: 'https://www.instagram.com/andreaslopfotografie/',
|
||||
},
|
||||
],
|
||||
email: { user: 'info', domain: 'andreaslop.nl' },
|
||||
};
|
||||
|
||||
export default siteContent;
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { SocialPlatform } from './socialPlatforms.ts';
|
||||
|
||||
// Vorm van de content die straks uit de CMS-API komt. Bewust platte data
|
||||
// (strings, objecten en arrays), zodat de API ze 1-op-1 kan leveren.
|
||||
|
||||
export interface SocialLink {
|
||||
platform: SocialPlatform;
|
||||
href: string; // alleen getoond als geldige https-URL (zie visibleSocials)
|
||||
}
|
||||
|
||||
// Het e-mailadres in delen: zo staat het volledige adres nergens letterlijk
|
||||
// in de HTML, de JavaScript-bundel of de API-respons (anti-spam).
|
||||
export interface EmailAddress {
|
||||
user: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
export interface SiteContent {
|
||||
footerIntro: string;
|
||||
socials: SocialLink[];
|
||||
email: EmailAddress;
|
||||
}
|
||||
|
||||
export interface HeroSlide {
|
||||
id: string;
|
||||
src: string;
|
||||
alt: string;
|
||||
}
|
||||
|
||||
export interface HeroCta {
|
||||
label: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface HeroContent {
|
||||
title: string;
|
||||
// Klein label in hoofdletters boven de titel: wat en waar, voor bezoekers
|
||||
// en zoekmachines (bv. "Lifestyle fotograaf · Huizen")
|
||||
tagline: string;
|
||||
cta: HeroCta;
|
||||
slides: HeroSlide[];
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { act } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { renderWithProviders } from '../test/renderWithProviders';
|
||||
import useRouteFocus from './useRouteFocus';
|
||||
|
||||
function Harness() {
|
||||
useRouteFocus();
|
||||
return (
|
||||
<main id="main" tabIndex={-1}>
|
||||
inhoud
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
describe('useRouteFocus', () => {
|
||||
it('zet de focus niet bij de eerste keer laden', async () => {
|
||||
await renderWithProviders(<Harness />, { path: '/' });
|
||||
expect(document.activeElement).toBe(document.body);
|
||||
});
|
||||
|
||||
it('zet de focus op main na een paginawissel', async () => {
|
||||
const { router } = await renderWithProviders(<Harness />, {
|
||||
path: '/',
|
||||
});
|
||||
await act(() => router.navigate({ to: '/portfolio' }));
|
||||
expect(document.activeElement).toBe(document.getElementById('main'));
|
||||
});
|
||||
|
||||
it('zet de focus niet als alleen de hash verandert', async () => {
|
||||
const { router } = await renderWithProviders(<Harness />, {
|
||||
path: '/portfolio',
|
||||
});
|
||||
await act(() => router.navigate({ to: '/portfolio', hash: 'top' }));
|
||||
expect(document.activeElement).toBe(document.body);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter } from '@tanstack/react-router';
|
||||
|
||||
// Na een paginawissel krijgt de inhoud (main#main) de focus, zodat een
|
||||
// schermlezer de nieuwe pagina voorleest (BR-A11Y-01). Niet bij de eerste
|
||||
// keer laden, en niet als alleen query of hash verandert. Scrollen blijft
|
||||
// aan de scroll restoration van de router.
|
||||
export default function useRouteFocus() {
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(
|
||||
() =>
|
||||
router.subscribe('onResolved', ({ fromLocation, pathChanged }) => {
|
||||
if (!fromLocation || !pathChanged) return;
|
||||
document.getElementById('main')?.focus({ preventScroll: true });
|
||||
}),
|
||||
[router],
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { backToTopThreshold } from './backToTopThreshold';
|
||||
|
||||
describe('backToTopThreshold', () => {
|
||||
it('is 60% van de viewporthoogte', () => {
|
||||
expect(backToTopThreshold(1000)).toBe(600);
|
||||
});
|
||||
|
||||
it('geeft 0 bij ongeldige hoogtes', () => {
|
||||
for (const h of [0, -10, NaN, Infinity, -Infinity]) {
|
||||
expect(backToTopThreshold(h)).toBe(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('ligt altijd tussen 0 en de hoogte (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.double({ min: 0, max: 1e7, noNaN: true }), (h) => {
|
||||
const t = backToTopThreshold(h);
|
||||
return t >= 0 && t <= h;
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('stijgt mee met de hoogte bij eindige waarden (monotoon)', () => {
|
||||
const finite = fc.double({ noNaN: true, noDefaultInfinity: true });
|
||||
fc.assert(
|
||||
fc.property(finite, finite, (a, b) => {
|
||||
const [lo, hi] = a <= b ? [a, b] : [b, a];
|
||||
return backToTopThreshold(lo) <= backToTopThreshold(hi);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('volgt het model 0.6 × max(0, h) (oracle)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.double(), (h) => {
|
||||
const model = Number.isFinite(h) ? 0.6 * Math.max(0, h) : 0;
|
||||
expect(backToTopThreshold(h)).toBe(model);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
// Vanaf hoeveel pixels scrollen de to-top-knop verschijnt: 60% van de
|
||||
// viewporthoogte (BR-TOP-01). Ongeldige of negatieve hoogtes tellen als 0.
|
||||
export function backToTopThreshold(viewportHeight: number): number {
|
||||
if (!Number.isFinite(viewportHeight) || viewportHeight <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return 0.6 * viewportHeight;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { copyrightLine } from './copyrightLine';
|
||||
|
||||
describe('copyrightLine', () => {
|
||||
it('heeft de vaste vorm', () => {
|
||||
expect(copyrightLine(2026)).toBe('© 2026 Andrea Slop Fotografie');
|
||||
});
|
||||
|
||||
it('het jaartal is er weer uit te halen (round-trip)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.integer({ min: 0, max: 9999 }), (year) => {
|
||||
const match = copyrightLine(year).match(/^© (\d+) /);
|
||||
return match !== null && Number(match[1]) === year;
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('begint met © en eindigt met de bedrijfsnaam (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.integer(), (year) => {
|
||||
const line = copyrightLine(year);
|
||||
return (
|
||||
line.startsWith('©') &&
|
||||
line.endsWith('Andrea Slop Fotografie')
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
// Copyrightregel in de onderste footerbalk (BR-FOOT-02)
|
||||
export function copyrightLine(year: number): string {
|
||||
return `© ${year} Andrea Slop Fotografie`;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { anyEmail, validEmail } from '../test/arbitraries';
|
||||
import { emailAddress } from './emailAddress';
|
||||
|
||||
describe('emailAddress', () => {
|
||||
it('voegt geldige delen samen', () => {
|
||||
expect(emailAddress({ user: 'info', domain: 'andreaslop.nl' })).toBe(
|
||||
'info@andreaslop.nl',
|
||||
);
|
||||
});
|
||||
|
||||
it('geeft null bij ongeldige delen', () => {
|
||||
for (const parts of [
|
||||
{ user: '', domain: 'andreaslop.nl' },
|
||||
{ user: 'info', domain: '' },
|
||||
{ user: 'in fo', domain: 'andreaslop.nl' },
|
||||
{ user: 'info@x', domain: 'andreaslop.nl' },
|
||||
{ user: 'info', domain: 'andreaslop' },
|
||||
{ user: 'info', domain: 'andrea@slop.nl' },
|
||||
]) {
|
||||
expect(emailAddress(parts)).toBeNull();
|
||||
}
|
||||
});
|
||||
|
||||
it('splitsen bij @ geeft de delen terug (round-trip)', () => {
|
||||
fc.assert(
|
||||
fc.property(validEmail, (parts) => {
|
||||
const address = emailAddress(parts);
|
||||
expect(address).not.toBeNull();
|
||||
const [user, domain] = address!.split('@');
|
||||
expect({ user, domain }).toEqual(parts);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('is null of bevat precies één @ en geen witruimte (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(anyEmail, (parts) => {
|
||||
const address = emailAddress(parts);
|
||||
return (
|
||||
address === null ||
|
||||
(address.split('@').length === 2 && !/\s/.test(address))
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { EmailAddress } from '../content/types';
|
||||
|
||||
const invalidPart = (part: string) => part === '' || /[\s@]/.test(part);
|
||||
|
||||
// Voegt het e-mailadres pas in de browser samen (BR-EMAIL-01). Geeft null bij
|
||||
// ongeldige delen, zodat de footer de Contact-kolom kan weglaten (BR-EMAIL-02).
|
||||
export function emailAddress({ user, domain }: EmailAddress): string | null {
|
||||
if (invalidPart(user) || invalidPart(domain) || !domain.includes('.')) {
|
||||
return null;
|
||||
}
|
||||
return `${user}@${domain}`;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { slidesToLoad } from './slidesToLoad';
|
||||
|
||||
describe('slidesToLoad', () => {
|
||||
it('laadt de actieve, de volgende en de vorige slide', () => {
|
||||
expect(slidesToLoad(3, 8)).toEqual([3, 4, 2]);
|
||||
});
|
||||
|
||||
it('loopt rond: vanaf de eerste is de vorige de laatste', () => {
|
||||
expect(slidesToLoad(0, 8)).toEqual([0, 1, 7]);
|
||||
expect(slidesToLoad(7, 8)).toEqual([7, 0, 6]);
|
||||
});
|
||||
|
||||
it('werkt met weinig of geen slides', () => {
|
||||
expect(slidesToLoad(0, 1)).toEqual([0]);
|
||||
expect(slidesToLoad(0, 2)).toEqual([0, 1]);
|
||||
expect(slidesToLoad(0, 0)).toEqual([]);
|
||||
expect(slidesToLoad(0, 2.5)).toEqual([]);
|
||||
});
|
||||
|
||||
it('geeft unieke geldige indexen, de actieve voorop (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.integer({ min: 1, max: 50 }),
|
||||
fc.integer({ min: -100, max: 100 }),
|
||||
(count, active) => {
|
||||
const result = slidesToLoad(active, count);
|
||||
expect(new Set(result).size).toBe(result.length);
|
||||
expect(result).toHaveLength(Math.min(count, 3));
|
||||
expect(result.every((i) => i >= 0 && i < count)).toBe(true);
|
||||
expect(result[0]).toBe(((active % count) + count) % count);
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('elke buurslide ligt een stap voor of achter de actieve (oracle)', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.integer({ min: 1, max: 50 }),
|
||||
fc.nat(),
|
||||
(count, active) => {
|
||||
const current = active % count;
|
||||
for (const i of slidesToLoad(active, count)) {
|
||||
const distance = Math.min(
|
||||
(i - current + count) % count,
|
||||
(current - i + count) % count,
|
||||
);
|
||||
expect(distance).toBeLessThanOrEqual(1);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
// Welke hero-slides geladen moeten zijn: de actieve en zijn buren, rondlopend.
|
||||
// Vanaf de eerste slide is de vorige de laatste (BR-HERO-01).
|
||||
export function slidesToLoad(active: number, count: number): number[] {
|
||||
if (!Number.isInteger(count) || count <= 0) {
|
||||
return [];
|
||||
}
|
||||
const current = ((active % count) + count) % count;
|
||||
return [
|
||||
...new Set([
|
||||
current,
|
||||
(current + 1) % count,
|
||||
(current - 1 + count) % count,
|
||||
]),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { socialLink } from '../test/arbitraries';
|
||||
import { visibleSocials } from './visibleSocials';
|
||||
|
||||
const isHttps = (href: string) => {
|
||||
try {
|
||||
return new URL(href).protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
describe('visibleSocials', () => {
|
||||
it('laat alleen geldige https-links door', () => {
|
||||
const result = visibleSocials([
|
||||
{ platform: 'facebook', href: 'https://facebook.com/x' },
|
||||
{ platform: 'instagram', href: '' },
|
||||
{ platform: 'instagram', href: 'http://instagram.com/x' },
|
||||
{ platform: 'facebook', href: 'javascript:alert(1)' },
|
||||
]);
|
||||
expect(result).toEqual([
|
||||
{ platform: 'facebook', href: 'https://facebook.com/x' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('is idempotent', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.array(socialLink), (socials) => {
|
||||
const once = visibleSocials(socials);
|
||||
expect(visibleSocials(once)).toEqual(once);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('is een deelreeks van de invoer in dezelfde volgorde (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.array(socialLink), (socials) => {
|
||||
const result = visibleSocials(socials);
|
||||
let i = 0;
|
||||
for (const item of socials) {
|
||||
if (item === result[i]) i++;
|
||||
}
|
||||
return i === result.length;
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('houdt precies de https-links over (oracle)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.array(socialLink), (socials) => {
|
||||
expect(visibleSocials(socials)).toEqual(
|
||||
socials.filter((s) => isHttps(s.href)),
|
||||
);
|
||||
return visibleSocials(socials).every((s) => isHttps(s.href));
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { SocialLink } from '../content/types.ts';
|
||||
|
||||
function isHttpsUrl(href: string): boolean {
|
||||
try {
|
||||
return new URL(href).protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Alleen links met een geldige https-URL (BR-SOC-01). Leeg, http:,
|
||||
// javascript: of iets onleesbaars uit het CMS wordt overgeslagen; de
|
||||
// volgorde blijft gelijk (BR-SOC-02).
|
||||
export function visibleSocials(socials: readonly SocialLink[]): SocialLink[] {
|
||||
return socials.filter((social) => isHttpsUrl(social.href));
|
||||
}
|
||||
@@ -3,8 +3,8 @@ import ReactDOM from 'react-dom/client';
|
||||
import { RouterProvider, createRouter } from '@tanstack/react-router';
|
||||
import { routeTree } from './routeTree.gen';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import { ThemeProvider } from 'next-themes';
|
||||
import system from './theme.ts';
|
||||
import ErrorPage from './components/StatusPage/ErrorPage';
|
||||
|
||||
import '@fontsource/jost/300.css';
|
||||
import '@fontsource/jost/400.css';
|
||||
@@ -12,7 +12,13 @@ import '@fontsource/jost/500.css';
|
||||
import '@fontsource/marcellus/400.css';
|
||||
|
||||
// Create a new router instance
|
||||
const router = createRouter({ routeTree });
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
// Nieuwe pagina begint bovenaan; terug/vooruit herstelt de positie (FR-08)
|
||||
scrollRestoration: true,
|
||||
// Fout in een pagina: foutpagina binnen de shell (FR-10)
|
||||
defaultErrorComponent: ErrorPage,
|
||||
});
|
||||
|
||||
// Register the router instance for type safety
|
||||
declare module '@tanstack/react-router' {
|
||||
@@ -31,15 +37,10 @@ if (!rootElement.innerHTML) {
|
||||
const root = ReactDOM.createRoot(rootElement);
|
||||
root.render(
|
||||
<StrictMode>
|
||||
{/* De site is alleen licht; de _dark-waarden in het thema blijven
|
||||
staan voor een eventuele donkere modus later */}
|
||||
<ChakraProvider value={system}>
|
||||
<ThemeProvider
|
||||
attribute="class"
|
||||
disableTransitionOnChange
|
||||
defaultTheme="light"
|
||||
enableSystem={false}
|
||||
>
|
||||
<RouterProvider router={router} />
|
||||
</ThemeProvider>
|
||||
<RouterProvider router={router} />
|
||||
</ChakraProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { footerNav, mainNav } from './navigation';
|
||||
|
||||
describe('menu', () => {
|
||||
it('hoofdmenu heeft de vaste volgorde', () => {
|
||||
expect(mainNav.map((item) => item.label)).toEqual([
|
||||
'Home',
|
||||
'Over mij',
|
||||
'Portfolio',
|
||||
'Soorten fotoshoots',
|
||||
'Contact',
|
||||
]);
|
||||
});
|
||||
|
||||
it('hoofdmenu begint met Home en bevat geen privacyverklaring', () => {
|
||||
expect(mainNav[0].to).toBe('/');
|
||||
expect(mainNav.map((item) => item.to)).not.toContain(
|
||||
'/privacyverklaring',
|
||||
);
|
||||
});
|
||||
|
||||
it('footermenu volgt het design plus de privacyverklaring', () => {
|
||||
expect(footerNav.map((item) => item.to)).toEqual([
|
||||
'/portfolio',
|
||||
'/soorten-fotoshoots',
|
||||
'/contact',
|
||||
'/privacyverklaring',
|
||||
]);
|
||||
});
|
||||
|
||||
it('geen dubbele routes binnen een menu', () => {
|
||||
for (const menu of [mainNav, footerNav]) {
|
||||
const paths = menu.map((item) => item.to);
|
||||
expect(new Set(paths).size).toBe(paths.length);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
import type { FileRoutesByTo } from './routeTree.gen.ts';
|
||||
|
||||
// Menu's verwijzen naar routes, en routes zijn code: het CMS kan geen
|
||||
// pagina's toevoegen. Een tikfout in `to` is daardoor een typefout.
|
||||
export type RoutePath = keyof FileRoutesByTo;
|
||||
|
||||
export interface NavItem {
|
||||
to: RoutePath;
|
||||
label: string;
|
||||
}
|
||||
|
||||
// Hoofdmenu: desktopnavigatie en mobiel menu
|
||||
export const mainNav: readonly NavItem[] = [
|
||||
{ to: '/', label: 'Home' },
|
||||
{ to: '/over-mij', label: 'Over mij' },
|
||||
{ to: '/portfolio', label: 'Portfolio' },
|
||||
{ to: '/soorten-fotoshoots', label: 'Soorten fotoshoots' },
|
||||
{ to: '/contact', label: 'Contact' },
|
||||
];
|
||||
|
||||
// Menu in de onderste footerbalk
|
||||
export const footerNav: readonly NavItem[] = [
|
||||
{ to: '/portfolio', label: 'Portfolio' },
|
||||
{ to: '/soorten-fotoshoots', label: 'Soorten fotoshoots' },
|
||||
{ to: '/contact', label: 'Contact' },
|
||||
{ to: '/privacyverklaring', label: 'Privacyverklaring' },
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
import { defineRecipe } from '@chakra-ui/react';
|
||||
|
||||
// Uitbreiding op Chakra's Container: de maximale breedte komt uit één token,
|
||||
// zodat de to-top-knop met dezelfde rand kan uitlijnen.
|
||||
const containerRecipe = defineRecipe({
|
||||
base: {
|
||||
maxWidth: 'content',
|
||||
},
|
||||
});
|
||||
|
||||
export default containerRecipe;
|
||||
@@ -0,0 +1,26 @@
|
||||
import { defineRecipe } from '@chakra-ui/react';
|
||||
|
||||
// Knoppen en links met alleen een icoon, over een foto (hero-pijlen, socials).
|
||||
// Half doorzichtig, vol bij hover of focus; de focusring is wit op de foto.
|
||||
const iconControlRecipe = defineRecipe({
|
||||
className: 'icon-control',
|
||||
base: {
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
// Minimaal 44px als klikdoel op touch (BR-RWD-04)
|
||||
minW: '44px',
|
||||
minH: '44px',
|
||||
color: 'white',
|
||||
opacity: 0.6,
|
||||
cursor: 'pointer',
|
||||
transitionProperty: 'opacity',
|
||||
transitionDuration: 'interaction',
|
||||
transitionTimingFunction: 'smooth',
|
||||
'--focus-ring-color': 'white',
|
||||
_hover: { opacity: 1 },
|
||||
_focusVisible: { opacity: 1 },
|
||||
},
|
||||
});
|
||||
|
||||
export default iconControlRecipe;
|
||||
@@ -0,0 +1,24 @@
|
||||
import { defineRecipe } from '@chakra-ui/react';
|
||||
|
||||
// Uitbreiding op Chakra's Link met de rustige linkstijl uit de footer.
|
||||
// ink.soft en accent.deep halen beide 4.5:1 op papier (NFR-01).
|
||||
const linkRecipe = defineRecipe({
|
||||
// Chakra zet de ringkleur per palet; hier de kleur van de site
|
||||
base: { focusRingColor: 'focusRing' },
|
||||
variants: {
|
||||
variant: {
|
||||
subtle: {
|
||||
color: 'ink.soft',
|
||||
textDecoration: 'none',
|
||||
rounded: 'none',
|
||||
transitionProperty: 'color',
|
||||
transitionDuration: 'interaction',
|
||||
transitionTimingFunction: 'smooth',
|
||||
_hover: { color: 'accent.deep' },
|
||||
_focusVisible: { color: 'accent.deep' },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default linkRecipe;
|
||||
@@ -34,14 +34,21 @@ const linkButtonRecipe = defineRecipe({
|
||||
bg: 'accent',
|
||||
color: 'white',
|
||||
_hover: { bg: 'accent.deep', borderColor: 'accent.deep' },
|
||||
_focusVisible: { bg: 'accent.deep', borderColor: 'accent.deep' },
|
||||
_focusVisible: {
|
||||
bg: 'accent.deep',
|
||||
borderColor: 'accent.deep',
|
||||
},
|
||||
},
|
||||
// Wit, voor over foto's
|
||||
light: {
|
||||
borderColor: 'white/70',
|
||||
color: 'white',
|
||||
_hover: { bg: 'white', borderColor: 'white', color: 'ink' },
|
||||
_focusVisible: { bg: 'white', borderColor: 'white', color: 'ink' },
|
||||
_focusVisible: {
|
||||
bg: 'white',
|
||||
borderColor: 'white',
|
||||
color: 'ink',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { defineRecipe } from '@chakra-ui/react';
|
||||
|
||||
// Chakra's skip link in de stijl van het design (.skip-link): donker vlak,
|
||||
// witte tekst, hoekig. Het gedrag (pas zichtbaar bij focus) blijft van Chakra.
|
||||
const skipNavLinkRecipe = defineRecipe({
|
||||
base: {
|
||||
bg: 'ink',
|
||||
color: 'white',
|
||||
rounded: 'none',
|
||||
px: '1.25rem',
|
||||
py: '0.75rem',
|
||||
textStyle: 'eyebrow',
|
||||
fontWeight: '400',
|
||||
focusRingColor: 'focusRing',
|
||||
_focusVisible: {
|
||||
top: 0,
|
||||
insetStart: 0,
|
||||
// Chakra's recipe zet geen z-index; zonder dit valt de link onder
|
||||
// de vaste header en zie je hem niet
|
||||
zIndex: 'skipNav',
|
||||
// De -1px marge van de verborgen toestand niet meenemen
|
||||
margin: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export default skipNavLinkRecipe;
|
||||
@@ -10,43 +10,102 @@
|
||||
|
||||
import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as ContactRouteImport } from './routes/contact'
|
||||
import { Route as OverMijRouteImport } from './routes/over-mij'
|
||||
import { Route as PortfolioRouteImport } from './routes/portfolio'
|
||||
import { Route as PrivacyverklaringRouteImport } from './routes/privacyverklaring'
|
||||
import { Route as SoortenFotoshootsRouteImport } from './routes/soorten-fotoshoots'
|
||||
|
||||
const IndexRoute = IndexRouteImport.update({
|
||||
id: '/',
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ContactRoute = ContactRouteImport.update({
|
||||
id: '/contact',
|
||||
path: '/contact',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const OverMijRoute = OverMijRouteImport.update({
|
||||
id: '/over-mij',
|
||||
path: '/over-mij',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const PortfolioRoute = PortfolioRouteImport.update({
|
||||
id: '/portfolio',
|
||||
path: '/portfolio',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const PrivacyverklaringRoute = PrivacyverklaringRouteImport.update({
|
||||
id: '/privacyverklaring',
|
||||
path: '/privacyverklaring',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const SoortenFotoshootsRoute = SoortenFotoshootsRouteImport.update({
|
||||
id: '/soorten-fotoshoots',
|
||||
path: '/soorten-fotoshoots',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/contact': typeof ContactRoute
|
||||
'/over-mij': typeof OverMijRoute
|
||||
'/portfolio': typeof PortfolioRoute
|
||||
'/privacyverklaring': typeof PrivacyverklaringRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/contact': typeof ContactRoute
|
||||
'/over-mij': typeof OverMijRoute
|
||||
'/portfolio': typeof PortfolioRoute
|
||||
'/privacyverklaring': typeof PrivacyverklaringRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/contact': typeof ContactRoute
|
||||
'/over-mij': typeof OverMijRoute
|
||||
'/portfolio': typeof PortfolioRoute
|
||||
'/privacyverklaring': typeof PrivacyverklaringRoute
|
||||
'/soorten-fotoshoots': typeof SoortenFotoshootsRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/' | '/over-mij'
|
||||
fullPaths:
|
||||
| '/'
|
||||
| '/contact'
|
||||
| '/over-mij'
|
||||
| '/portfolio'
|
||||
| '/privacyverklaring'
|
||||
| '/soorten-fotoshoots'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/' | '/over-mij'
|
||||
id: '__root__' | '/' | '/over-mij'
|
||||
to:
|
||||
| '/'
|
||||
| '/contact'
|
||||
| '/over-mij'
|
||||
| '/portfolio'
|
||||
| '/privacyverklaring'
|
||||
| '/soorten-fotoshoots'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/contact'
|
||||
| '/over-mij'
|
||||
| '/portfolio'
|
||||
| '/privacyverklaring'
|
||||
| '/soorten-fotoshoots'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
ContactRoute: typeof ContactRoute
|
||||
OverMijRoute: typeof OverMijRoute
|
||||
PortfolioRoute: typeof PortfolioRoute
|
||||
PrivacyverklaringRoute: typeof PrivacyverklaringRoute
|
||||
SoortenFotoshootsRoute: typeof SoortenFotoshootsRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
@@ -58,6 +117,13 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/contact': {
|
||||
id: '/contact'
|
||||
path: '/contact'
|
||||
fullPath: '/contact'
|
||||
preLoaderRoute: typeof ContactRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/over-mij': {
|
||||
id: '/over-mij'
|
||||
path: '/over-mij'
|
||||
@@ -65,12 +131,37 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof OverMijRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/portfolio': {
|
||||
id: '/portfolio'
|
||||
path: '/portfolio'
|
||||
fullPath: '/portfolio'
|
||||
preLoaderRoute: typeof PortfolioRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/privacyverklaring': {
|
||||
id: '/privacyverklaring'
|
||||
path: '/privacyverklaring'
|
||||
fullPath: '/privacyverklaring'
|
||||
preLoaderRoute: typeof PrivacyverklaringRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/soorten-fotoshoots': {
|
||||
id: '/soorten-fotoshoots'
|
||||
path: '/soorten-fotoshoots'
|
||||
fullPath: '/soorten-fotoshoots'
|
||||
preLoaderRoute: typeof SoortenFotoshootsRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
ContactRoute: ContactRoute,
|
||||
OverMijRoute: OverMijRoute,
|
||||
PortfolioRoute: PortfolioRoute,
|
||||
PrivacyverklaringRoute: PrivacyverklaringRoute,
|
||||
SoortenFotoshootsRoute: SoortenFotoshootsRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
import { lazy, Suspense } from 'react';
|
||||
import { createRootRoute, HeadContent } from '@tanstack/react-router';
|
||||
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools';
|
||||
import AppShell from '../components/AppShell';
|
||||
import ErrorPage from '../components/StatusPage/ErrorPage';
|
||||
import NotFound from '../components/StatusPage/NotFound';
|
||||
import siteContent from '../content/siteContent';
|
||||
import { siteHead } from '../seo';
|
||||
|
||||
// Devtools alleen tijdens het ontwikkelen; ze komen niet in de productiebuild
|
||||
const RouterDevtools = import.meta.env.DEV
|
||||
? lazy(() =>
|
||||
import('@tanstack/react-router-devtools').then((module) => ({
|
||||
default: module.TanStackRouterDevtools,
|
||||
})),
|
||||
)
|
||||
: () => null;
|
||||
|
||||
const RootLayout = () => (
|
||||
<>
|
||||
{/* Titel en meta-tags van de actieve route; React zet ze in <head> */}
|
||||
<HeadContent />
|
||||
<AppShell />
|
||||
<TanStackRouterDevtools />
|
||||
<Suspense>
|
||||
<RouterDevtools />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
|
||||
export const Route = createRootRoute({
|
||||
head: () => siteHead,
|
||||
head: () => siteHead(siteContent),
|
||||
component: RootLayout,
|
||||
// Onbekende URL: 404 binnen de shell (FR-09)
|
||||
notFoundComponent: NotFound,
|
||||
// Fout in de shell zelf: foutpagina zonder shell, als vangnet (FR-10)
|
||||
errorComponent: ErrorPage,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import PageIntro from '../components/PageIntro/PageIntro';
|
||||
import { pageHead } from '../seo';
|
||||
|
||||
export const Route = createFileRoute('/contact')({
|
||||
head: () => pageHead('/contact'),
|
||||
component: Contact,
|
||||
});
|
||||
|
||||
// Placeholder tot de echte pagina er is (noindex via sitePages)
|
||||
function Contact() {
|
||||
return (
|
||||
<PageIntro eyebrow="Neem contact op" title="Contact">
|
||||
Deze pagina is nog in de maak. Kom snel terug!
|
||||
</PageIntro>
|
||||
);
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import Hero from '../components/Hero/Hero';
|
||||
import heroContent from '../components/Hero/heroContent';
|
||||
import heroContent from '../content/heroContent';
|
||||
import siteContent from '../content/siteContent';
|
||||
import { pageHead } from '../seo';
|
||||
|
||||
export const Route = createFileRoute('/')({
|
||||
head: () =>
|
||||
pageHead({
|
||||
title: 'Lifestyle fotograaf in Huizen | Andrea Slop Fotografie',
|
||||
description:
|
||||
"Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots.",
|
||||
}),
|
||||
head: () => pageHead('/'),
|
||||
component: Index,
|
||||
});
|
||||
|
||||
function Index() {
|
||||
return <Hero content={heroContent} />;
|
||||
return <Hero content={heroContent} socials={siteContent.socials} />;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { pageHead } from "../seo";
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import PageIntro from '../components/PageIntro/PageIntro';
|
||||
import { pageHead } from '../seo';
|
||||
|
||||
export const Route = createFileRoute("/over-mij")({
|
||||
head: () =>
|
||||
pageHead({
|
||||
title: "Over mij | Andrea Slop Fotografie",
|
||||
description:
|
||||
"Hi! Ik ben Andrea, lifestyle fotograaf uit Huizen. Ik leg jullie vast zoals jullie zijn: spontaan en natuurlijk, zonder ongemakkelijke poses.",
|
||||
}),
|
||||
component: About,
|
||||
export const Route = createFileRoute('/over-mij')({
|
||||
head: () => pageHead('/over-mij'),
|
||||
component: About,
|
||||
});
|
||||
|
||||
// Placeholder tot de echte pagina er is (noindex via sitePages)
|
||||
function About() {
|
||||
return <div className="p-2">Hello from About!</div>;
|
||||
return (
|
||||
<PageIntro eyebrow="Andrea Slop Fotografie" title="Over mij">
|
||||
Deze pagina is nog in de maak. Kom snel terug!
|
||||
</PageIntro>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import PageIntro from '../components/PageIntro/PageIntro';
|
||||
import { pageHead } from '../seo';
|
||||
|
||||
export const Route = createFileRoute('/portfolio')({
|
||||
head: () => pageHead('/portfolio'),
|
||||
component: Portfolio,
|
||||
});
|
||||
|
||||
// Placeholder tot de echte pagina er is (noindex via sitePages)
|
||||
function Portfolio() {
|
||||
return (
|
||||
<PageIntro eyebrow="Werk" title="Portfolio">
|
||||
Deze pagina is nog in de maak. Kom snel terug!
|
||||
</PageIntro>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import PageIntro from '../components/PageIntro/PageIntro';
|
||||
import { pageHead } from '../seo';
|
||||
|
||||
export const Route = createFileRoute('/privacyverklaring')({
|
||||
head: () => pageHead('/privacyverklaring'),
|
||||
component: PrivacyStatement,
|
||||
});
|
||||
|
||||
// Placeholder tot de echte pagina er is (noindex via sitePages)
|
||||
function PrivacyStatement() {
|
||||
return (
|
||||
<PageIntro eyebrow="Privacy" title="Privacyverklaring">
|
||||
Deze pagina is nog in de maak. Kom snel terug!
|
||||
</PageIntro>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { createFileRoute } from '@tanstack/react-router';
|
||||
import PageIntro from '../components/PageIntro/PageIntro';
|
||||
import { pageHead } from '../seo';
|
||||
|
||||
export const Route = createFileRoute('/soorten-fotoshoots')({
|
||||
head: () => pageHead('/soorten-fotoshoots'),
|
||||
component: PhotoshootTypes,
|
||||
});
|
||||
|
||||
// Placeholder tot de echte pagina er is (noindex via sitePages)
|
||||
function PhotoshootTypes() {
|
||||
return (
|
||||
<PageIntro eyebrow="Mogelijkheden" title="Soorten fotoshoots">
|
||||
Deze pagina is nog in de maak. Kom snel terug!
|
||||
</PageIntro>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import siteContent from './content/siteContent';
|
||||
import {
|
||||
canonicalUrl,
|
||||
jsonLdScript,
|
||||
pageHead,
|
||||
professionalService,
|
||||
siteHead,
|
||||
siteUrl,
|
||||
} from './seo';
|
||||
import { routePath } from './test/arbitraries';
|
||||
|
||||
const meta = (head: ReturnType<typeof pageHead>, key: string) =>
|
||||
head.meta.find(
|
||||
(m) =>
|
||||
('name' in m && m.name === key) ||
|
||||
('property' in m && m.property === key),
|
||||
);
|
||||
|
||||
describe('canonicalUrl', () => {
|
||||
it('maakt een absolute URL zonder slash, query of hash', () => {
|
||||
expect(canonicalUrl('/')).toBe(`${siteUrl}/`);
|
||||
expect(canonicalUrl('')).toBe(`${siteUrl}/`);
|
||||
expect(canonicalUrl('/portfolio/')).toBe(`${siteUrl}/portfolio`);
|
||||
expect(canonicalUrl('/contact?x=1#top')).toBe(`${siteUrl}/contact`);
|
||||
expect(canonicalUrl('portfolio')).toBe(`${siteUrl}/portfolio`);
|
||||
});
|
||||
|
||||
it('is idempotent', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
routePath,
|
||||
fc.constantFrom('', '/', '?a=1', '#x'),
|
||||
(path, suffix) => {
|
||||
const once = canonicalUrl(path + suffix);
|
||||
expect(canonicalUrl(once.slice(siteUrl.length))).toBe(once);
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('begint met siteUrl en eindigt alleen bij de root op een slash (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.string(), (path) => {
|
||||
const url = canonicalUrl(path);
|
||||
const rest = url.slice(siteUrl.length);
|
||||
return (
|
||||
url.startsWith(siteUrl + '/') &&
|
||||
!/[?#]/.test(rest) &&
|
||||
(rest === '/' || !rest.endsWith('/'))
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('pageHead', () => {
|
||||
it('zet titel, canonical en preview voor de homepage, zonder robots-tag', () => {
|
||||
const head = pageHead('/');
|
||||
expect(head.meta[0]).toEqual({
|
||||
title: 'Lifestyle fotograaf in Huizen | Andrea Slop Fotografie',
|
||||
});
|
||||
expect(head.links).toEqual([{ rel: 'canonical', href: `${siteUrl}/` }]);
|
||||
expect(meta(head, 'og:url')).toMatchObject({ content: `${siteUrl}/` });
|
||||
expect(meta(head, 'og:image')).toMatchObject({
|
||||
content: `${siteUrl}/og-image.jpg`,
|
||||
});
|
||||
expect(meta(head, 'robots')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('zet noindex op een placeholder', () => {
|
||||
const head = pageHead('/portfolio');
|
||||
expect(meta(head, 'robots')).toMatchObject({ content: 'noindex' });
|
||||
expect(head.links[0].href).toBe(`${siteUrl}/portfolio`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('jsonLdScript', () => {
|
||||
it('geeft na parsen dezelfde data terug (round-trip)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.jsonValue(), (value) => {
|
||||
expect(JSON.parse(jsonLdScript(value))).toEqual(
|
||||
JSON.parse(JSON.stringify(value)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('bevat nooit < of >, dus nooit een sluitende script-tag (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.jsonValue(), fc.string(), (value, text) => {
|
||||
const out = jsonLdScript({ value, text: text + '</script>' });
|
||||
return !/[<>]/.test(out);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('professionalService en siteHead', () => {
|
||||
it('beschrijft de fotograaf zonder e-mailadres', () => {
|
||||
const data = professionalService(siteContent);
|
||||
expect(data['@type']).toBe('ProfessionalService');
|
||||
expect(data.address.addressLocality).toBe('Huizen');
|
||||
expect(data.sameAs).toEqual(siteContent.socials.map((s) => s.href));
|
||||
expect(JSON.stringify(data)).not.toContain('@andreaslop');
|
||||
});
|
||||
|
||||
it('laat ongeldige socials weg uit sameAs', () => {
|
||||
const data = professionalService({
|
||||
...siteContent,
|
||||
socials: [{ platform: 'facebook', href: 'http://onveilig.nl' }],
|
||||
});
|
||||
expect(data.sameAs).toEqual([]);
|
||||
});
|
||||
|
||||
it('zet de gestructureerde data als ld+json-script', () => {
|
||||
const head = siteHead(siteContent);
|
||||
expect(head.scripts[0].type).toBe('application/ld+json');
|
||||
expect(JSON.parse(head.scripts[0].children)['@type']).toBe(
|
||||
'ProfessionalService',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -1,31 +1,101 @@
|
||||
// Head-tags per pagina, voor de `head`-optie van een route. Titel en
|
||||
// beschrijving komen later uit het CMS.
|
||||
//
|
||||
// Richtlijn: titel max. ~60 tekens, beschrijving max. ~155 tekens; daarna
|
||||
// kort Google ze af in de zoekresultaten.
|
||||
export function pageHead({
|
||||
title,
|
||||
description,
|
||||
}: {
|
||||
title: string;
|
||||
description: string;
|
||||
}) {
|
||||
// SEO: head-tags per pagina en voor de hele site, plus gestructureerde data.
|
||||
// Titels en beschrijvingen staan in het pagina-register (sitePages.ts).
|
||||
import type { SiteContent } from './content/types.ts';
|
||||
import { visibleSocials } from './lib/visibleSocials.ts';
|
||||
import type { RoutePath } from './navigation.ts';
|
||||
import sitePages from './sitePages.ts';
|
||||
|
||||
export const siteUrl = 'https://andreaslop.nl';
|
||||
export const siteName = 'Andrea Slop Fotografie';
|
||||
|
||||
// Preview-afbeelding voor WhatsApp, Facebook en LinkedIn (public/og-image.jpg)
|
||||
export const defaultOgImage = {
|
||||
path: '/og-image.jpg',
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: 'Takjes paarse heide op een arm met een bloementattoo',
|
||||
};
|
||||
|
||||
// Absolute URL zonder slash aan het eind (behalve de homepage), zonder query
|
||||
// of hash (BR-SEO-02)
|
||||
export function canonicalUrl(path: string, base: string = siteUrl): string {
|
||||
const clean = path.split(/[?#]/)[0].replace(/\/+$/, '');
|
||||
if (clean === '') {
|
||||
return `${base}/`;
|
||||
}
|
||||
return base + (clean.startsWith('/') ? clean : `/${clean}`);
|
||||
}
|
||||
|
||||
// Head-tags van een pagina uit het register (BR-SEO-01 t/m 04)
|
||||
export function pageHead(path: RoutePath) {
|
||||
const page = sitePages[path];
|
||||
const title = `${page.title} | ${siteName}`;
|
||||
const url = canonicalUrl(path);
|
||||
const image = page.ogImage ?? defaultOgImage;
|
||||
|
||||
return {
|
||||
meta: [
|
||||
{ title },
|
||||
{ name: 'description', content: description },
|
||||
{ name: 'description', content: page.description },
|
||||
// noindex voor placeholders, tot de echte pagina live gaat
|
||||
...(page.indexed ? [] : [{ name: 'robots', content: 'noindex' }]),
|
||||
// Voor link-previews (WhatsApp, Facebook, LinkedIn)
|
||||
{ property: 'og:title', content: title },
|
||||
{ property: 'og:description', content: description },
|
||||
{ property: 'og:description', content: page.description },
|
||||
{ property: 'og:url', content: url },
|
||||
{ property: 'og:image', content: siteUrl + image.path },
|
||||
{ property: 'og:image:alt', content: image.alt },
|
||||
{ property: 'og:image:width', content: String(image.width) },
|
||||
{ property: 'og:image:height', content: String(image.height) },
|
||||
],
|
||||
links: [{ rel: 'canonical', href: url }],
|
||||
};
|
||||
}
|
||||
|
||||
// Tags die voor de hele site gelden
|
||||
export const siteHead = {
|
||||
meta: [
|
||||
{ property: 'og:site_name', content: 'Andrea Slop Fotografie' },
|
||||
{ property: 'og:locale', content: 'nl_NL' },
|
||||
{ property: 'og:type', content: 'website' },
|
||||
],
|
||||
};
|
||||
// JSON voor een <script type="application/ld+json">. <, > en & worden
|
||||
// ge-escaped, zodat content het script-element nooit kan afsluiten (BR-SEO-05).
|
||||
export function jsonLdScript(data: unknown): string {
|
||||
return JSON.stringify(data)
|
||||
.replace(/</g, '\\u003c')
|
||||
.replace(/>/g, '\\u003e')
|
||||
.replace(/&/g, '\\u0026');
|
||||
}
|
||||
|
||||
// Gestructureerde data: een lokale fotograaf in Huizen. Bewust zonder
|
||||
// e-mailadres, anders staat het alsnog leesbaar in de pagina.
|
||||
export function professionalService(content: SiteContent) {
|
||||
return {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'ProfessionalService',
|
||||
name: siteName,
|
||||
url: `${siteUrl}/`,
|
||||
logo: `${siteUrl}/logo.png`,
|
||||
image: siteUrl + defaultOgImage.path,
|
||||
description: sitePages['/'].description,
|
||||
address: {
|
||||
'@type': 'PostalAddress',
|
||||
addressLocality: 'Huizen',
|
||||
addressCountry: 'NL',
|
||||
},
|
||||
areaServed: { '@type': 'Place', name: 'Huizen' },
|
||||
sameAs: visibleSocials(content.socials).map((social) => social.href),
|
||||
};
|
||||
}
|
||||
|
||||
// Tags die voor de hele site gelden, plus de gestructureerde data
|
||||
export function siteHead(content: SiteContent) {
|
||||
return {
|
||||
meta: [
|
||||
{ property: 'og:site_name', content: siteName },
|
||||
{ property: 'og:locale', content: 'nl_NL' },
|
||||
{ property: 'og:type', content: 'website' },
|
||||
{ name: 'twitter:card', content: 'summary_large_image' },
|
||||
],
|
||||
scripts: [
|
||||
{
|
||||
type: 'application/ld+json',
|
||||
children: jsonLdScript(professionalService(content)),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import type { RoutePath } from './navigation.ts';
|
||||
|
||||
// Het register van alle pagina's: één bron voor de head van elke route en
|
||||
// voor sitemap.xml. Door het type moet elke route hier staan, en niets anders.
|
||||
//
|
||||
// Richtlijn: titel max. ~60 tekens inclusief " | Andrea Slop Fotografie",
|
||||
// beschrijving max. ~155 tekens; daarna kort Google ze af.
|
||||
export interface PageMeta {
|
||||
title: string;
|
||||
description: string;
|
||||
// false = noindex en niet in de sitemap (placeholders). Gaat een echte
|
||||
// pagina live, zet dit dan op true.
|
||||
indexed: boolean;
|
||||
ogImage?: { path: string; width: number; height: number; alt: string };
|
||||
}
|
||||
|
||||
export interface SitePage extends PageMeta {
|
||||
path: string;
|
||||
}
|
||||
|
||||
const sitePages: Record<RoutePath, PageMeta> = {
|
||||
'/': {
|
||||
title: 'Lifestyle fotograaf in Huizen',
|
||||
description:
|
||||
"Lifestyle fotograaf in Huizen en omgeving. Ik leg je mooiste momenten vast in spontane, kleurrijke foto's. Voor loveshoots, gezins- en zwangerschapsshoots.",
|
||||
indexed: true,
|
||||
},
|
||||
'/over-mij': {
|
||||
title: 'Over mij',
|
||||
description:
|
||||
'Hi! Ik ben Andrea, lifestyle fotograaf uit Huizen. Ik leg jullie vast zoals jullie zijn: spontaan en natuurlijk, zonder ongemakkelijke poses.',
|
||||
indexed: false,
|
||||
},
|
||||
'/portfolio': {
|
||||
title: 'Portfolio',
|
||||
description:
|
||||
"Bekijk het portfolio van Andrea Slop Fotografie: spontane lifestylefoto's van gezinnen, stellen, zwangerschappen en newborns in Huizen en omgeving.",
|
||||
indexed: false,
|
||||
},
|
||||
'/soorten-fotoshoots': {
|
||||
title: 'Soorten fotoshoots',
|
||||
description:
|
||||
'Van loveshoot tot gezins-, zwangerschaps- en newbornshoot: ontdek welke fotoshoots Andrea Slop Fotografie aanbiedt in Huizen en omgeving.',
|
||||
indexed: false,
|
||||
},
|
||||
'/contact': {
|
||||
title: 'Contact',
|
||||
description:
|
||||
'Neem contact op met Andrea Slop Fotografie voor een fotoshoot in Huizen en omgeving. Ik denk graag met je mee over jullie wensen.',
|
||||
indexed: false,
|
||||
},
|
||||
'/privacyverklaring': {
|
||||
title: 'Privacyverklaring',
|
||||
description:
|
||||
"Lees hoe Andrea Slop Fotografie omgaat met je persoonsgegevens en met de foto's die tijdens een fotoshoot gemaakt worden.",
|
||||
indexed: false,
|
||||
},
|
||||
};
|
||||
|
||||
// Het register als lijst, voor de sitemap
|
||||
export function pageList(pages: Record<string, PageMeta>): SitePage[] {
|
||||
return Object.entries(pages).map(([path, meta]) => ({ path, ...meta }));
|
||||
}
|
||||
|
||||
export default sitePages;
|
||||
@@ -0,0 +1,56 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { canonicalUrl } from './seo';
|
||||
import { sitemapXml } from './sitemap';
|
||||
import sitePages, { pageList } from './sitePages';
|
||||
import { routePath } from './test/arbitraries';
|
||||
|
||||
const base = 'https://voorbeeld.nl';
|
||||
|
||||
// Parse de XML terug en geef de <loc>-waarden
|
||||
const locs = (xml: string) => {
|
||||
const doc = new DOMParser().parseFromString(xml, 'application/xml');
|
||||
expect(doc.getElementsByTagName('parsererror')).toHaveLength(0);
|
||||
return [...doc.getElementsByTagName('loc')].map((el) => el.textContent);
|
||||
};
|
||||
|
||||
const page = fc.record({ path: routePath, indexed: fc.boolean() });
|
||||
|
||||
describe('sitemapXml', () => {
|
||||
it('bevat nu alleen de homepage', () => {
|
||||
expect(locs(sitemapXml(pageList(sitePages), base))).toEqual([
|
||||
`${base}/`,
|
||||
]);
|
||||
});
|
||||
|
||||
it('bevat precies de geindexeerde pagina, elk een keer (oracle)', () => {
|
||||
fc.assert(
|
||||
fc.property(fc.array(page), (pages) => {
|
||||
const expected = new Set(
|
||||
pages
|
||||
.filter((p) => p.indexed)
|
||||
.map((p) => canonicalUrl(p.path, base)),
|
||||
);
|
||||
const actual = locs(sitemapXml(pages, base));
|
||||
expect(new Set(actual)).toEqual(expected);
|
||||
expect(actual).toHaveLength(expected.size);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('blijft geldige XML met speciale tekens (round-trip)', () => {
|
||||
const special = fc
|
||||
.array(fc.constantFrom('a', '&', '<', '>', "'", '"', '-'), {
|
||||
minLength: 1,
|
||||
maxLength: 8,
|
||||
})
|
||||
.map((chars) => '/' + chars.join(''));
|
||||
fc.assert(
|
||||
fc.property(special, (path) => {
|
||||
expect(
|
||||
locs(sitemapXml([{ path, indexed: true }], base)),
|
||||
).toEqual([canonicalUrl(path, base)]);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import { canonicalUrl } from './seo.ts';
|
||||
import type { SitePage } from './sitePages.ts';
|
||||
|
||||
const escapeXml = (value: string) =>
|
||||
value
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
|
||||
// sitemap.xml met alleen de geïndexeerde pagina's, elke URL één keer.
|
||||
// Geen lastmod: Google negeert onbetrouwbare datums (BR-SEO-06).
|
||||
export function sitemapXml(
|
||||
pages: readonly Pick<SitePage, 'path' | 'indexed'>[],
|
||||
base: string,
|
||||
): string {
|
||||
const urls = new Set(
|
||||
pages
|
||||
.filter((page) => page.indexed)
|
||||
.map((page) => canonicalUrl(page.path, base)),
|
||||
);
|
||||
const entries = [...urls]
|
||||
.map((url) => ` <url><loc>${escapeXml(url)}</loc></url>`)
|
||||
.join('\n');
|
||||
|
||||
return (
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n' +
|
||||
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n' +
|
||||
(entries ? `${entries}\n` : '') +
|
||||
'</urlset>\n'
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import fc from 'fast-check';
|
||||
import type { EmailAddress, SocialLink } from '../content/types';
|
||||
|
||||
// Gedeelde generators voor de property-based tests (fast-check)
|
||||
|
||||
const platform = fc.constantFrom('facebook' as const, 'instagram' as const);
|
||||
|
||||
// Een padsegment zoals in een route: kleine letters, cijfers en streepjes
|
||||
export const pathSegment = fc.stringMatching(/^[a-z0-9-]{1,12}$/);
|
||||
|
||||
export const routePath = fc
|
||||
.array(pathSegment, { maxLength: 4 })
|
||||
.map((segments) => '/' + segments.join('/'));
|
||||
|
||||
export const httpsUrl = fc.webUrl({ validSchemes: ['https'] });
|
||||
|
||||
// Mix van geldige en ongeldige href's zoals het CMS ze zou kunnen leveren
|
||||
export const anyHref = fc.oneof(
|
||||
httpsUrl,
|
||||
fc.webUrl({ validSchemes: ['http'] }),
|
||||
fc.constantFrom(
|
||||
'',
|
||||
'javascript:alert(1)',
|
||||
'/relatief',
|
||||
'geen url',
|
||||
'https://',
|
||||
),
|
||||
fc.string(),
|
||||
);
|
||||
|
||||
export const socialLink: fc.Arbitrary<SocialLink> = fc.record({
|
||||
platform,
|
||||
href: anyHref,
|
||||
});
|
||||
|
||||
// Een geldig deel van een e-mailadres: geen spaties, geen @
|
||||
const emailPart = fc.stringMatching(/^[a-z0-9._-]{1,20}$/);
|
||||
|
||||
export const validEmail: fc.Arbitrary<EmailAddress> = fc.record({
|
||||
user: emailPart,
|
||||
domain: fc
|
||||
.tuple(emailPart, fc.stringMatching(/^[a-z]{2,6}$/))
|
||||
.map(([name, tld]) => `${name}.${tld}`),
|
||||
});
|
||||
|
||||
export const anyEmail: fc.Arbitrary<EmailAddress> = fc.oneof(
|
||||
validEmail,
|
||||
fc.record({ user: fc.string(), domain: fc.string() }),
|
||||
);
|
||||
@@ -0,0 +1,31 @@
|
||||
import axe from 'axe-core';
|
||||
|
||||
// Eigen matcher op axe-core: vitest-axe gebruikt nog de oude Vitest-types.
|
||||
// Kleurcontrast meet axe niet in jsdom; dat dekt Lighthouse af (NFR-A-05).
|
||||
export async function axeResults(container: Element) {
|
||||
return axe.run(container, {
|
||||
rules: { 'color-contrast': { enabled: false } },
|
||||
});
|
||||
}
|
||||
|
||||
export function toHaveNoViolations(results: axe.AxeResults) {
|
||||
const violations = results.violations;
|
||||
return {
|
||||
pass: violations.length === 0,
|
||||
message: () =>
|
||||
violations
|
||||
.map(
|
||||
(v) =>
|
||||
`${v.id}: ${v.help}\n` +
|
||||
v.nodes.map((n) => ` ${n.html}`).join('\n'),
|
||||
)
|
||||
.join('\n\n'),
|
||||
};
|
||||
}
|
||||
|
||||
// Vitest 5: eigen matchers horen op de Matchers-interface
|
||||
declare module 'vitest' {
|
||||
interface Matchers<R> {
|
||||
toHaveNoViolations(): R;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import {
|
||||
createMemoryHistory,
|
||||
createRootRoute,
|
||||
createRoute,
|
||||
createRouter,
|
||||
RouterProvider,
|
||||
} from '@tanstack/react-router';
|
||||
import { render } from '@testing-library/react';
|
||||
import system from '../theme';
|
||||
|
||||
// Rendert een component binnen het Chakra-thema en een router op `path`.
|
||||
// Een splat-route vangt elk pad op, zodat links en aria-current werken
|
||||
// zonder de echte route tree.
|
||||
export async function renderWithProviders(ui: ReactNode, { path = '/' } = {}) {
|
||||
const rootRoute = createRootRoute({ component: () => <>{ui}</> });
|
||||
const splat = createRoute({ getParentRoute: () => rootRoute, path: '$' });
|
||||
const router = createRouter({
|
||||
routeTree: rootRoute.addChildren([splat]),
|
||||
history: createMemoryHistory({ initialEntries: [path] }),
|
||||
});
|
||||
await router.load();
|
||||
|
||||
const result = render(
|
||||
<ChakraProvider value={system}>
|
||||
<RouterProvider router={router} />
|
||||
</ChakraProvider>,
|
||||
);
|
||||
return { ...result, router };
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
import { cleanup } from '@testing-library/react';
|
||||
import fc from 'fast-check';
|
||||
import { afterEach, expect, inject, vi } from 'vitest';
|
||||
import { toHaveNoViolations } from './axe';
|
||||
|
||||
expect.extend({ toHaveNoViolations });
|
||||
|
||||
// Seed van deze run, gekozen en gelogd in config/testSeed.ts (PBT-08)
|
||||
fc.configureGlobal({ seed: inject('fcSeed') });
|
||||
|
||||
// Zonder globals ruimt Testing Library niet zelf op
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
// jsdom kent geen matchMedia (Chakra-breakpoints, reduced motion) en geen
|
||||
// scrollTo. Tests die het gedrag nodig hebben, overschrijven deze stubs.
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
configurable: true,
|
||||
value: (query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
}),
|
||||
});
|
||||
window.scrollTo = () => {};
|
||||
@@ -1,13 +1,29 @@
|
||||
import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
|
||||
import containerRecipe from './recipes/container';
|
||||
import iconControlRecipe from './recipes/iconControl';
|
||||
import linkRecipe from './recipes/link';
|
||||
import linkButtonRecipe from './recipes/linkButton';
|
||||
import skipNavLinkRecipe from './recipes/skipNavLink';
|
||||
|
||||
const config = defineConfig({
|
||||
cssVarsRoot: ':where(:root, :host)',
|
||||
cssVarsPrefix: 'slp',
|
||||
preflight: true,
|
||||
globalCss: {
|
||||
body: {
|
||||
height: '250vh',
|
||||
html: {
|
||||
// Chakra-componenten met een eigen focusring lezen deze variabele
|
||||
'--focus-ring-color': '{colors.focusRing}',
|
||||
},
|
||||
// Eén focusstijl voor de hele site (BR-THEME-02)
|
||||
'*:focus-visible': {
|
||||
outlineWidth: '2px',
|
||||
outlineStyle: 'solid',
|
||||
outlineColor: 'var(--focus-ring-color)',
|
||||
outlineOffset: '2px',
|
||||
},
|
||||
// Programmatische focusdoelen (main na een paginawissel) krijgen geen ring
|
||||
'[tabindex="-1"]:focus': {
|
||||
outline: 'none',
|
||||
},
|
||||
},
|
||||
theme: {
|
||||
@@ -63,6 +79,14 @@ const config = defineConfig({
|
||||
interaction: { value: '0.45s' }, // hover, focus
|
||||
fade: { value: '1.2s' }, // overvloeien van foto's
|
||||
},
|
||||
// Stapelvolgorde van de vaste shell-onderdelen, van laag naar hoog
|
||||
zIndex: {
|
||||
backToTop: { value: 8 },
|
||||
mobileNav: { value: 9 },
|
||||
header: { value: 10 },
|
||||
// Binnen de header: de hamburger boven het logo en menu
|
||||
menuToggle: { value: 1 },
|
||||
},
|
||||
gradients: {
|
||||
// Donker verloop over hero-foto's, zodat witte tekst leesbaar blijft
|
||||
scrim: {
|
||||
@@ -92,6 +116,13 @@ const config = defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
// Kleur van de focusring; op foto's zet iconControl hem op wit
|
||||
focusRing: {
|
||||
value: {
|
||||
_light: '{colors.accent.deep}',
|
||||
_dark: '{colors.white}',
|
||||
},
|
||||
},
|
||||
},
|
||||
sizes: {
|
||||
header: {
|
||||
@@ -100,10 +131,16 @@ const config = defineConfig({
|
||||
// Na scrollen; op mobiel krimpt de balk niet
|
||||
sticky: { value: { base: '66px', lg: '68px' } },
|
||||
},
|
||||
// Maximale breedte van de content (Container en de to-top-knop)
|
||||
content: { value: '{sizes.8xl}' },
|
||||
},
|
||||
spacing: {
|
||||
// Zelfde waarde voor content die onder de balk begint (pt="header")
|
||||
header: { value: '{sizes.header}' },
|
||||
// Begin van de inhoud op een gewone pagina: onder de balk, met lucht
|
||||
pageTop: {
|
||||
value: 'calc({sizes.header} + clamp(3rem, 7vw, 6rem))',
|
||||
},
|
||||
},
|
||||
},
|
||||
textStyles: {
|
||||
@@ -123,6 +160,14 @@ const config = defineConfig({
|
||||
lineHeight: '1',
|
||||
},
|
||||
},
|
||||
// De h1 van een gewone pagina (PageIntro, StatusPage)
|
||||
pageTitle: {
|
||||
value: {
|
||||
fontFamily: 'heading',
|
||||
fontSize: { base: '2.25rem', md: '2.75rem', lg: '3.25rem' },
|
||||
lineHeight: '1.15',
|
||||
},
|
||||
},
|
||||
},
|
||||
recipes: {
|
||||
// Koppen zijn in het design niet vet en iets gespatieerd
|
||||
@@ -132,7 +177,11 @@ const config = defineConfig({
|
||||
letterSpacing: '0.01em',
|
||||
},
|
||||
},
|
||||
container: containerRecipe,
|
||||
link: linkRecipe,
|
||||
skipNavLink: skipNavLinkRecipe,
|
||||
linkButton: linkButtonRecipe,
|
||||
iconControl: iconControlRecipe,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"lib": ["ES2023", "DOM"],
|
||||
"types": ["vite/client"],
|
||||
"allowArbitraryExtensions": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"lib": ["ES2023", "DOM"],
|
||||
"types": ["vite/client"],
|
||||
"allowArbitraryExtensions": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src", "src/components"]
|
||||
"include": ["src", "config", "vite.config.ts"]
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { tanstackRouter } from '@tanstack/router-plugin/vite'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
// Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'
|
||||
tanstackRouter({
|
||||
target: 'react',
|
||||
autoCodeSplitting: true,
|
||||
}),
|
||||
react(),
|
||||
],
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,50 @@
|
||||
/// <reference types="vitest/config" />
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { tanstackRouter } from '@tanstack/router-plugin/vite';
|
||||
import { securityHeaders } from './config/securityHeaders.ts';
|
||||
import sitemapPlugin from './config/sitemapPlugin.ts';
|
||||
|
||||
// 100% dekking voor de pure functies (NFR-M-02); de rest wordt alleen gerapporteerd
|
||||
const fullCoverage = {
|
||||
statements: 100,
|
||||
branches: 100,
|
||||
functions: 100,
|
||||
lines: 100,
|
||||
};
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
// Please make sure that '@tanstack/router-plugin' is passed before '@vitejs/plugin-react'
|
||||
tanstackRouter({
|
||||
target: 'react',
|
||||
autoCodeSplitting: true,
|
||||
}),
|
||||
react(),
|
||||
sitemapPlugin(),
|
||||
],
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
// Dev: zelfde headers, met alleen de uitzonderingen die Vite nodig heeft
|
||||
server: { headers: securityHeaders('development') },
|
||||
// Preview: de strenge productieset
|
||||
preview: { headers: securityHeaders('production') },
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
globalSetup: ['./config/testSeed.ts'],
|
||||
setupFiles: ['./src/test/setup.ts'],
|
||||
css: false,
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
include: ['src/**/*.{ts,tsx}', 'config/**/*.ts'],
|
||||
exclude: ['src/routeTree.gen.ts', 'src/test/**', '**/*.test.*'],
|
||||
thresholds: {
|
||||
'src/lib/**': fullCoverage,
|
||||
'src/seo.ts': fullCoverage,
|
||||
'src/sitemap.ts': fullCoverage,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||