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>
This commit is contained in:
2026-10-18 17:05:02 +02:00
co-authored by Claude Opus 5.5
parent b5b7f3b3db
commit 4d6408b607
99 changed files with 7883 additions and 414 deletions
@@ -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>
);
}