Thema-fundament: variant (B/E) x modus (licht/donker), tijdreis-knop en overgang
Vervangt rood/paars door tokens per variant en modus, voegt ModeToggle en icoon-knop VariantToggle toe, VariantRenderer met lazy E-chunk, dither-overgang (uit bij minder beweging), theme-init.js tegen themaflits en tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { Component } from 'react';
|
||||
import type { ErrorInfo, ReactNode } from 'react';
|
||||
|
||||
interface EBoundaryProps {
|
||||
children: ReactNode;
|
||||
/** Falls back to variant B and shows the alert (BR-U1-8). */
|
||||
onError: () => void;
|
||||
}
|
||||
|
||||
/** Error boundary around the lazy E variant: a crash in E never takes the whole site down. */
|
||||
export class EBoundary extends Component<EBoundaryProps, { failed: boolean }> {
|
||||
state = { failed: false };
|
||||
|
||||
static getDerivedStateFromError() {
|
||||
return { failed: true };
|
||||
}
|
||||
|
||||
componentDidCatch(error: Error, info: ErrorInfo) {
|
||||
console.error('Variant E crashed', error, info.componentStack);
|
||||
this.props.onError();
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.failed) {
|
||||
return null;
|
||||
}
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
|
||||
/** Polite live region that announces variant changes to screen readers (BR-U1-7). */
|
||||
export function LiveRegion() {
|
||||
const { announcement } = useTheme();
|
||||
|
||||
return (
|
||||
<div role="status" aria-live="polite" className="sr-only" data-testid="live-region">
|
||||
{announcement}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { navLinks } from '../../features/landing/data/content';
|
||||
import { ThemeToggle } from '../ui/ThemeToggle';
|
||||
import { ModeToggle } from '../ui/ModeToggle';
|
||||
import { VariantToggle } from '../ui/VariantToggle';
|
||||
import { handleAnchorClick } from '../../utils/scrollToHash';
|
||||
|
||||
export function Nav() {
|
||||
@@ -21,7 +22,7 @@ export function Nav() {
|
||||
>
|
||||
SLP<span className="text-accent">.</span>Software
|
||||
</a>
|
||||
<ul className="flex items-center gap-7">
|
||||
<ul className="flex items-center gap-3 sm:gap-7">
|
||||
{navLinks.map((link) =>
|
||||
link.isCta ? (
|
||||
<li key={link.href} className="hidden sm:block">
|
||||
@@ -47,7 +48,10 @@ export function Nav() {
|
||||
),
|
||||
)}
|
||||
<li>
|
||||
<ThemeToggle />
|
||||
<ModeToggle />
|
||||
</li>
|
||||
<li>
|
||||
<VariantToggle />
|
||||
</li>
|
||||
<li className="sm:hidden">
|
||||
<button
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Nav } from './Nav';
|
||||
import { Footer } from './Footer';
|
||||
import { VariantRenderer } from './VariantRenderer';
|
||||
import { TransitionOverlay } from './TransitionOverlay';
|
||||
import { LiveRegion } from './LiveRegion';
|
||||
import { VariantAlert } from './VariantAlert';
|
||||
import { UmamiAnalytics } from '../shared/UmamiAnalytics';
|
||||
import { SentryTestButton } from '../shared/SentryTestButton';
|
||||
|
||||
@@ -8,9 +12,20 @@ export function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<div className="font-sans min-h-screen bg-bg text-text">
|
||||
<UmamiAnalytics />
|
||||
<Nav />
|
||||
{children}
|
||||
<Footer />
|
||||
<VariantRenderer
|
||||
b={
|
||||
<>
|
||||
<Nav />
|
||||
<main id="main" tabIndex={-1} className="outline-none">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<TransitionOverlay />
|
||||
<LiveRegion />
|
||||
<VariantAlert />
|
||||
<SentryTestButton />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { usePrefersReducedMotion } from '../../shared/hooks/usePrefersReducedMotion';
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
|
||||
/**
|
||||
* Pixel-dither overlay of the time-travel transition (BR-U1-6). Renders nothing while idle and
|
||||
* nothing at all under prefers-reduced-motion (BR-U1-9).
|
||||
*/
|
||||
export function TransitionOverlay() {
|
||||
const { transition } = useTheme();
|
||||
const reducedMotion = usePrefersReducedMotion();
|
||||
|
||||
if (reducedMotion || transition.phase === 'idle') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="tt-overlay"
|
||||
data-phase={transition.phase}
|
||||
data-testid="transition-overlay"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
|
||||
/** Alert shown when the time-travel variant could not be loaded or crashed (BR-U1-8). */
|
||||
export function VariantAlert() {
|
||||
const { variantError, retryVariant, dismissVariantError } = useTheme();
|
||||
|
||||
if (!variantError) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
role="alert"
|
||||
data-testid="variant-alert"
|
||||
className="fixed bottom-4 left-1/2 z-[110] flex w-[min(92vw,28rem)] -translate-x-1/2 flex-wrap items-center gap-3 rounded border border-accent-line bg-surface px-4 py-3 text-sm text-text shadow-lg"
|
||||
>
|
||||
<span className="flex-1">De tijdreis kon niet worden geladen.</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={retryVariant}
|
||||
data-testid="variant-alert-retry"
|
||||
className="rounded border border-line px-3 py-1.5 font-medium hover:border-accent-line"
|
||||
>
|
||||
Opnieuw proberen
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={dismissVariantError}
|
||||
aria-label="Melding sluiten"
|
||||
data-testid="variant-alert-dismiss"
|
||||
className="rounded px-2 py-1.5 text-muted hover:text-text"
|
||||
>
|
||||
Sluiten
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { lazy, Suspense } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
import { EBoundary } from './EBoundary';
|
||||
|
||||
// Variant E is its own chunk (FR-6): visitors who never use the easter egg never download it.
|
||||
const LandingE = lazy(() => import('../../variants/e/LandingE'));
|
||||
|
||||
/**
|
||||
* Renders the eager B shell or the lazy E landing depending on the current variant. The
|
||||
* transition (see ThemeProvider) preloads the E chunk before the swap, so the Suspense fallback is
|
||||
* only a safety net.
|
||||
*/
|
||||
export function VariantRenderer({ b }: { b: ReactNode }) {
|
||||
const { variant, reportVariantError } = useTheme();
|
||||
|
||||
if (variant === 'b') {
|
||||
return <>{b}</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<EBoundary onError={reportVariantError}>
|
||||
<Suspense fallback={null}>
|
||||
<LandingE />
|
||||
</Suspense>
|
||||
</EBoundary>
|
||||
);
|
||||
}
|
||||
@@ -14,7 +14,6 @@ function renderNav() {
|
||||
describe('Nav', () => {
|
||||
beforeEach(() => {
|
||||
window.localStorage.clear();
|
||||
document.documentElement.className = '';
|
||||
});
|
||||
|
||||
it('renders all nav links including the CTA', () => {
|
||||
@@ -25,14 +24,24 @@ describe('Nav', () => {
|
||||
expect(screen.getByTestId('nav-cta-link')).toHaveTextContent('Start project');
|
||||
});
|
||||
|
||||
it('renders the theme toggle with a Dutch accessible label', () => {
|
||||
it('renders the mode toggle and the icon-only variant toggle with Dutch labels', () => {
|
||||
renderNav();
|
||||
expect(screen.getByRole('button', { name: 'Wissel kleurthema' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Donkere weergave' })).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Tijdreis: bekijk de site zoals vroeger' }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('toggles the theme when the toggle button is clicked', () => {
|
||||
it('puts the variant toggle right after the mode toggle', () => {
|
||||
renderNav();
|
||||
const toggle = screen.getByTestId('theme-toggle-button');
|
||||
const mode = screen.getByTestId('mode-toggle-button');
|
||||
const variant = screen.getByTestId('variant-toggle-button');
|
||||
expect(mode.compareDocumentPosition(variant) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
|
||||
});
|
||||
|
||||
it('toggles the mode when the mode toggle is clicked', () => {
|
||||
renderNav();
|
||||
const toggle = screen.getByTestId('mode-toggle-button');
|
||||
expect(toggle).toHaveAttribute('aria-pressed', 'false');
|
||||
fireEvent.click(toggle);
|
||||
expect(toggle).toHaveAttribute('aria-pressed', 'true');
|
||||
@@ -58,11 +67,10 @@ describe('Nav', () => {
|
||||
renderNav();
|
||||
fireEvent.click(screen.getByTestId('nav-mobile-toggle'));
|
||||
const mobileMenu = screen.getByTestId('nav-mobile-menu');
|
||||
|
||||
const link = mobileMenu.querySelector('a[href="#pakketten"]');
|
||||
expect(mobileMenu).toBeInTheDocument();
|
||||
const link = mobileMenu.querySelector('a');
|
||||
expect(link).not.toBeNull();
|
||||
fireEvent.click(link as HTMLAnchorElement);
|
||||
|
||||
expect(screen.queryByTestId('nav-mobile-menu')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { VariantRenderer } from '../VariantRenderer';
|
||||
import { TransitionOverlay } from '../TransitionOverlay';
|
||||
import { LiveRegion } from '../LiveRegion';
|
||||
import { VariantAlert } from '../VariantAlert';
|
||||
import { EBoundary } from '../EBoundary';
|
||||
import { ThemeProvider } from '../../../theme/ThemeProvider';
|
||||
import { VariantToggle } from '../../ui/VariantToggle';
|
||||
import { clearMatchMedia, mockMatchMedia } from '../../../test/matchMedia';
|
||||
import { REDUCED_MOTION_QUERY } from '../../../shared/hooks/usePrefersReducedMotion';
|
||||
|
||||
function renderApp(loadVariant: (v: 'b' | 'e') => Promise<unknown> = () => Promise.resolve()) {
|
||||
return render(
|
||||
<ThemeProvider loadVariant={loadVariant}>
|
||||
<VariantRenderer
|
||||
b={
|
||||
<>
|
||||
<VariantToggle />
|
||||
<main id="main" tabIndex={-1}>
|
||||
Moderne weergave
|
||||
</main>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<TransitionOverlay />
|
||||
<LiveRegion />
|
||||
<VariantAlert />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('VariantRenderer and transition UI', () => {
|
||||
beforeEach(() => window.localStorage.clear());
|
||||
afterEach(() => {
|
||||
clearMatchMedia();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('renders B first', () => {
|
||||
renderApp();
|
||||
expect(screen.getByText('Moderne weergave')).toBeInTheDocument();
|
||||
expect(screen.queryByRole('heading', { name: 'Tijdreis' })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows the lazy E landing after the switch and announces it (FR-6, BR-U1-7)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderApp();
|
||||
fireEvent.click(screen.getByTestId('variant-toggle-button'));
|
||||
expect(await screen.findByRole('heading', { name: 'Tijdreis' })).toBeInTheDocument();
|
||||
expect(screen.queryByText('Moderne weergave')).not.toBeInTheDocument();
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('live-region')).toHaveTextContent('Tijdreis-weergave geladen.'),
|
||||
);
|
||||
|
||||
// The way back to B exists inside E.
|
||||
fireEvent.click(screen.getAllByTestId('variant-toggle-button')[0]);
|
||||
expect(await screen.findByText('Moderne weergave')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows the dither overlay during the transition (BR-U1-6)', async () => {
|
||||
mockMatchMedia();
|
||||
renderApp();
|
||||
expect(screen.queryByTestId('transition-overlay')).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByTestId('variant-toggle-button'));
|
||||
expect(screen.getByTestId('transition-overlay')).toHaveAttribute('data-phase', 'cover');
|
||||
expect(screen.getByTestId('transition-overlay')).toHaveAttribute('aria-hidden', 'true');
|
||||
await waitFor(
|
||||
() => expect(screen.queryByTestId('transition-overlay')).not.toBeInTheDocument(),
|
||||
{
|
||||
timeout: 2000,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('renders no overlay at all under reduced motion (BR-U1-9)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderApp();
|
||||
fireEvent.click(screen.getByTestId('variant-toggle-button'));
|
||||
expect(screen.queryByTestId('transition-overlay')).not.toBeInTheDocument();
|
||||
await screen.findByRole('heading', { name: 'Tijdreis' });
|
||||
expect(screen.queryByTestId('transition-overlay')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('stays in B with an alert when E cannot be loaded, and retry recovers (BR-U1-8)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
const load = vi
|
||||
.fn<(v: 'b' | 'e') => Promise<unknown>>()
|
||||
.mockRejectedValueOnce(new Error('offline'))
|
||||
.mockResolvedValue(undefined);
|
||||
renderApp(load);
|
||||
fireEvent.click(screen.getByTestId('variant-toggle-button'));
|
||||
|
||||
expect(await screen.findByRole('alert')).toHaveTextContent(
|
||||
'De tijdreis kon niet worden geladen.',
|
||||
);
|
||||
expect(screen.getByText('Moderne weergave')).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByTestId('variant-alert-retry'));
|
||||
expect(await screen.findByRole('heading', { name: 'Tijdreis' })).toBeInTheDocument();
|
||||
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('lets the visitor dismiss the alert', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderApp(() => Promise.reject(new Error('offline')));
|
||||
fireEvent.click(screen.getByTestId('variant-toggle-button'));
|
||||
await screen.findByRole('alert');
|
||||
fireEvent.click(screen.getByTestId('variant-alert-dismiss'));
|
||||
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('EBoundary', () => {
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
it('calls onError and renders nothing when the child throws (BR-U1-8)', () => {
|
||||
vi.spyOn(console, 'error').mockImplementation(() => {});
|
||||
const onError = vi.fn();
|
||||
function Bomb(): never {
|
||||
throw new Error('boom');
|
||||
}
|
||||
const { container } = render(
|
||||
<EBoundary onError={onError}>
|
||||
<Bomb />
|
||||
</EBoundary>,
|
||||
);
|
||||
expect(onError).toHaveBeenCalledTimes(1);
|
||||
expect(container).toBeEmptyDOMElement();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
|
||||
/**
|
||||
* Light/dark switch (requirements FR-4, BR-U1-4, BR-U1-12). Two states; starts from the system
|
||||
* preference and remembers the visitor's choice after the first click.
|
||||
*/
|
||||
export function ModeToggle() {
|
||||
const { mode, toggleMode } = useTheme();
|
||||
const isDark = mode === 'dark';
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleMode}
|
||||
aria-label="Donkere weergave"
|
||||
aria-pressed={isDark}
|
||||
title="Donkere weergave"
|
||||
data-testid="mode-toggle-button"
|
||||
className="flex h-11 w-11 items-center justify-center rounded-full border border-line text-text transition-colors hover:border-accent-line focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent sm:h-8 sm:w-8"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
viewBox="0 0 24 24"
|
||||
width="16"
|
||||
height="16"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
data-testid="mode-toggle-icon"
|
||||
>
|
||||
{isDark ? (
|
||||
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
||||
) : (
|
||||
<>
|
||||
<circle cx="12" cy="12" r="4" />
|
||||
<path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" />
|
||||
</>
|
||||
)}
|
||||
</svg>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
|
||||
/**
|
||||
* Visible theme switcher (requirements FR-3, Functional Design Q1/Q7).
|
||||
* Rendered as a small icon/swatch button in the nav.
|
||||
*/
|
||||
export function ThemeToggle() {
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
const isPurple = theme === 'purple';
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleTheme}
|
||||
aria-label="Wissel kleurthema"
|
||||
aria-pressed={isPurple}
|
||||
data-testid="theme-toggle-button"
|
||||
className="font-mono flex h-8 w-8 items-center justify-center rounded-full border border-line text-xs font-medium text-text transition-colors hover:border-accent-line"
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="block h-4 w-4 rounded-full bg-accent"
|
||||
data-testid="theme-toggle-swatch"
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { useTheme } from '../../theme/ThemeProvider';
|
||||
|
||||
/**
|
||||
* Icon-only button next to the mode toggle that switches between B and E (FR-4, BR-U1-6,
|
||||
* BR-U1-12). The label changes with the current variant; the tooltip equals the label.
|
||||
*/
|
||||
export function VariantToggle() {
|
||||
const { variant, toggleVariant, transition } = useTheme();
|
||||
const inE = variant === 'e';
|
||||
const label = inE ? 'Terug naar nu' : 'Tijdreis: bekijk de site zoals vroeger';
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleVariant}
|
||||
aria-label={label}
|
||||
title={label}
|
||||
disabled={transition.phase !== 'idle'}
|
||||
data-testid="variant-toggle-button"
|
||||
className="flex h-11 w-11 items-center justify-center rounded-full border border-line text-text transition-colors hover:border-accent-line focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-60 sm:h-8 sm:w-8"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
viewBox="0 0 24 24"
|
||||
width="16"
|
||||
height="16"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
{/* Clock with a counter-clockwise arrow: "back in time" */}
|
||||
<path d="M3 12a9 9 0 1 0 3-6.7" />
|
||||
<path d="M3 4v5h5" />
|
||||
<path d="M12 7v5l3 2" />
|
||||
</svg>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { ModeToggle } from '../ModeToggle';
|
||||
import { VariantToggle } from '../VariantToggle';
|
||||
import { ThemeProvider } from '../../../theme/ThemeProvider';
|
||||
import { clearMatchMedia, mockMatchMedia } from '../../../test/matchMedia';
|
||||
import { REDUCED_MOTION_QUERY } from '../../../shared/hooks/usePrefersReducedMotion';
|
||||
|
||||
function renderToggles() {
|
||||
return render(
|
||||
<ThemeProvider loadVariant={() => Promise.resolve()}>
|
||||
<ModeToggle />
|
||||
<VariantToggle />
|
||||
<main id="main" tabIndex={-1} />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('ModeToggle', () => {
|
||||
beforeEach(() => window.localStorage.clear());
|
||||
afterEach(() => clearMatchMedia());
|
||||
|
||||
it('has a Dutch accessible name and reflects the mode in aria-pressed (BR-U1-12)', () => {
|
||||
renderToggles();
|
||||
const button = screen.getByRole('button', { name: 'Donkere weergave' });
|
||||
expect(button).toHaveAttribute('aria-pressed', 'false');
|
||||
fireEvent.click(button);
|
||||
expect(button).toHaveAttribute('aria-pressed', 'true');
|
||||
});
|
||||
|
||||
it('is a real button with a touch target of at least 44px on mobile (BR-U1-12)', () => {
|
||||
renderToggles();
|
||||
const button = screen.getByTestId('mode-toggle-button');
|
||||
expect(button.tagName).toBe('BUTTON');
|
||||
expect(button).toHaveClass('h-11', 'w-11');
|
||||
});
|
||||
});
|
||||
|
||||
describe('VariantToggle', () => {
|
||||
beforeEach(() => window.localStorage.clear());
|
||||
afterEach(() => clearMatchMedia());
|
||||
|
||||
it('is icon-only with a label that changes with the variant (BR-U1-12)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderToggles();
|
||||
const button = screen.getByTestId('variant-toggle-button');
|
||||
expect(button).toHaveAccessibleName('Tijdreis: bekijk de site zoals vroeger');
|
||||
expect(button).toHaveAttribute('title', 'Tijdreis: bekijk de site zoals vroeger');
|
||||
expect(button.textContent).toBe('');
|
||||
expect(button).toHaveClass('h-11', 'w-11');
|
||||
|
||||
fireEvent.click(button);
|
||||
await waitFor(() => expect(button).toHaveAccessibleName('Terug naar nu'));
|
||||
});
|
||||
|
||||
it('is disabled while a switch is running', async () => {
|
||||
renderToggles();
|
||||
const button = screen.getByTestId('variant-toggle-button');
|
||||
fireEvent.click(button);
|
||||
expect(button).toBeDisabled();
|
||||
await waitFor(() => expect(button).toBeEnabled(), { timeout: 2000 });
|
||||
});
|
||||
});
|
||||
@@ -6,6 +6,9 @@
|
||||
* Weights match the reference designs' Google Fonts request:
|
||||
* Sora: 400;600;700;800 — Instrument Sans: 400;500;600 — JetBrains Mono: 400;500;700
|
||||
*/
|
||||
// Archivo (variable: weight 100-900, width 62-125%) is the display/body face of design B.
|
||||
// The three families below are removed when the B sections are restyled (unit U2).
|
||||
import '@fontsource-variable/archivo/wdth.css';
|
||||
import '@fontsource/sora/400.css';
|
||||
import '@fontsource/sora/600.css';
|
||||
import '@fontsource/sora/700.css';
|
||||
|
||||
+126
-34
@@ -2,36 +2,73 @@
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* Theme tokens — values ported 1-to-1 from References/slp-software-rood.html (red, default)
|
||||
and References/slp-software.html (purple, alternate). See
|
||||
aidlc-docs/features/react-frontend/construction/react-frontend-app/functional-design/domain-entities.md
|
||||
(ThemeTokens) for the data model these mirror. */
|
||||
.theme-red {
|
||||
--color-bg: #140c0e;
|
||||
--color-surface: #1f1315;
|
||||
--color-surface-2: #291719;
|
||||
--color-line: #402226;
|
||||
--color-text: #f5eaeb;
|
||||
--color-muted: #b69c9f;
|
||||
--color-accent: #e04848;
|
||||
--color-accent-soft: rgba(224, 72, 72, 0.16);
|
||||
--color-accent-line: rgba(224, 72, 72, 0.4);
|
||||
--color-accent-hover: #ea6161;
|
||||
--color-accent-contrast: #140c0e;
|
||||
/* Theme tokens: variant (b | e) x mode (light | dark), selected by <html data-variant data-mode>
|
||||
(set before first paint by public/theme-init.js and kept in sync by ThemeProvider).
|
||||
Semantic names stay the same so the Tailwind colors in tailwind.config.ts keep working.
|
||||
B values follow the canvas design B (accent #7A1414); E values are base tokens, refined per era
|
||||
in unit U5 (accent #AC0000). See
|
||||
aidlc-docs/features/redesign-modern-timetravel/construction/theme-foundation/functional-design/domain-entities.md */
|
||||
|
||||
/* Default (also used when the attributes are missing): B light. */
|
||||
:root,
|
||||
html[data-variant='b'][data-mode='light'] {
|
||||
color-scheme: light;
|
||||
--color-bg: #ffffff;
|
||||
--color-surface: #f1efec;
|
||||
--color-surface-2: #faf8f5;
|
||||
--color-line: #e4e0dc;
|
||||
--color-text: #0e0d0d;
|
||||
--color-muted: #5c5753;
|
||||
--color-accent: #7a1414;
|
||||
--color-accent-soft: rgba(122, 20, 20, 0.1);
|
||||
--color-accent-line: rgba(122, 20, 20, 0.35);
|
||||
--color-accent-hover: #911a1a;
|
||||
--color-accent-contrast: #ffffff;
|
||||
}
|
||||
|
||||
.theme-purple {
|
||||
--color-bg: #0e1220;
|
||||
--color-surface: #151a2c;
|
||||
--color-surface-2: #1b2138;
|
||||
--color-line: #262e4a;
|
||||
--color-text: #e9ebf5;
|
||||
--color-muted: #98a0ba;
|
||||
--color-accent: #8b7cff;
|
||||
--color-accent-soft: rgba(139, 124, 255, 0.14);
|
||||
--color-accent-line: rgba(139, 124, 255, 0.35);
|
||||
--color-accent-hover: #9d90ff;
|
||||
--color-accent-contrast: #0e1220;
|
||||
html[data-variant='b'][data-mode='dark'] {
|
||||
color-scheme: dark;
|
||||
--color-bg: #0f0e0e;
|
||||
--color-surface: #181615;
|
||||
--color-surface-2: #232020;
|
||||
--color-line: #3a3532;
|
||||
--color-text: #f3f0ec;
|
||||
--color-muted: #b3ada7;
|
||||
--color-accent: #e5524a;
|
||||
--color-accent-soft: rgba(229, 82, 74, 0.16);
|
||||
--color-accent-line: rgba(229, 82, 74, 0.4);
|
||||
--color-accent-hover: #ec6a62;
|
||||
--color-accent-contrast: #0f0e0e;
|
||||
}
|
||||
|
||||
html[data-variant='e'][data-mode='light'] {
|
||||
color-scheme: light;
|
||||
--color-bg: #ffffff;
|
||||
--color-surface: #f3f3f3;
|
||||
--color-surface-2: #e9e9e9;
|
||||
--color-line: #d0d0d0;
|
||||
--color-text: #1a1a1a;
|
||||
--color-muted: #555555;
|
||||
--color-accent: #ac0000;
|
||||
--color-accent-soft: rgba(172, 0, 0, 0.1);
|
||||
--color-accent-line: rgba(172, 0, 0, 0.35);
|
||||
--color-accent-hover: #c40000;
|
||||
--color-accent-contrast: #ffffff;
|
||||
}
|
||||
|
||||
html[data-variant='e'][data-mode='dark'] {
|
||||
color-scheme: dark;
|
||||
--color-bg: #1b1b1d;
|
||||
--color-surface: #232326;
|
||||
--color-surface-2: #2c2c30;
|
||||
--color-line: #3d3d42;
|
||||
--color-text: #ededed;
|
||||
--color-muted: #a8a8ad;
|
||||
--color-accent: #ff6b5e;
|
||||
--color-accent-soft: rgba(255, 107, 94, 0.16);
|
||||
--color-accent-line: rgba(255, 107, 94, 0.4);
|
||||
--color-accent-hover: #ff8277;
|
||||
--color-accent-contrast: #1b1b1d;
|
||||
}
|
||||
|
||||
html {
|
||||
@@ -49,15 +86,15 @@ body {
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
/* Instant, non-animated theme switch when the visitor prefers reduced motion (BR-5). */
|
||||
.theme-red,
|
||||
.theme-purple {
|
||||
transition: background-color 0.2s ease, color 0.2s ease;
|
||||
/* Smooth colour change on mode switch; instant for visitors who prefer reduced motion (BR-U1-9). */
|
||||
html {
|
||||
transition:
|
||||
background-color 0.2s ease,
|
||||
color 0.2s ease;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.theme-red,
|
||||
.theme-purple {
|
||||
html {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -82,3 +119,58 @@ body {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Time-travel transition between variants (BR-U1-6): a pixel-dither overlay that covers the page
|
||||
(phase "cover"), stays while the variant swaps, then clears (phase "reveal"). Not rendered at all
|
||||
under prefers-reduced-motion (see TransitionOverlay) and hidden here as a safety net. */
|
||||
@keyframes tt-dither-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes tt-dither-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tt-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 100;
|
||||
pointer-events: all;
|
||||
background-color: var(--color-accent);
|
||||
background-image: conic-gradient(
|
||||
var(--color-bg) 25%,
|
||||
transparent 0 50%,
|
||||
var(--color-bg) 0 75%,
|
||||
transparent 0
|
||||
);
|
||||
background-size: 8px 8px;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.tt-overlay[data-phase='cover'] {
|
||||
animation: tt-dither-in 300ms steps(6) forwards;
|
||||
}
|
||||
|
||||
.tt-overlay[data-phase='swap'] {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tt-overlay[data-phase='reveal'] {
|
||||
animation: tt-dither-out 300ms steps(6) forwards;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.tt-overlay {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { createRootRoute, Outlet } from '@tanstack/react-router';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import { ErrorBoundary } from '../components/shared/ErrorBoundary';
|
||||
import { ThemeProvider } from '../theme/ThemeProvider';
|
||||
import { loadVariant } from '../theme/loadVariant';
|
||||
import { RootLayout } from '../components/layout/RootLayout';
|
||||
import { queryClient } from '../lib/queryClient';
|
||||
|
||||
@@ -12,7 +13,7 @@ import { queryClient } from '../lib/queryClient';
|
||||
export const rootRoute = createRootRoute({
|
||||
component: () => (
|
||||
<ErrorBoundary>
|
||||
<ThemeProvider>
|
||||
<ThemeProvider loadVariant={loadVariant}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<RootLayout>
|
||||
<Outlet />
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { clearMatchMedia, mockMatchMedia } from '../../../test/matchMedia';
|
||||
import { PREFERS_DARK_QUERY, usePrefersDark } from '../usePrefersDark';
|
||||
import { REDUCED_MOTION_QUERY, usePrefersReducedMotion } from '../usePrefersReducedMotion';
|
||||
|
||||
function Probe() {
|
||||
return (
|
||||
<div>
|
||||
<span data-testid="dark">{String(usePrefersDark())}</span>
|
||||
<span data-testid="reduced">{String(usePrefersReducedMotion())}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
describe('media query hooks', () => {
|
||||
afterEach(() => clearMatchMedia());
|
||||
|
||||
it('default to false when matchMedia is unavailable', () => {
|
||||
render(<Probe />);
|
||||
expect(screen.getByTestId('dark')).toHaveTextContent('false');
|
||||
expect(screen.getByTestId('reduced')).toHaveTextContent('false');
|
||||
});
|
||||
|
||||
it('read the initial value and follow live changes', () => {
|
||||
const media = mockMatchMedia({ [PREFERS_DARK_QUERY]: true });
|
||||
render(<Probe />);
|
||||
expect(screen.getByTestId('dark')).toHaveTextContent('true');
|
||||
expect(screen.getByTestId('reduced')).toHaveTextContent('false');
|
||||
|
||||
act(() => media.set(PREFERS_DARK_QUERY, false));
|
||||
act(() => media.set(REDUCED_MOTION_QUERY, true));
|
||||
expect(screen.getByTestId('dark')).toHaveTextContent('false');
|
||||
expect(screen.getByTestId('reduced')).toHaveTextContent('true');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { useSyncExternalStore } from 'react';
|
||||
|
||||
/** Safe `matchMedia` access: environments without it (jsdom, very old browsers) count as "no match". */
|
||||
export function matchesMedia(query: string): boolean {
|
||||
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
||||
return false;
|
||||
}
|
||||
return window.matchMedia(query).matches;
|
||||
}
|
||||
|
||||
/** Subscribes to a media query and re-renders when its result changes. */
|
||||
export function useMediaQuery(query: string): boolean {
|
||||
return useSyncExternalStore(
|
||||
(onChange) => {
|
||||
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
||||
return () => {};
|
||||
}
|
||||
const list = window.matchMedia(query);
|
||||
list.addEventListener('change', onChange);
|
||||
return () => list.removeEventListener('change', onChange);
|
||||
},
|
||||
() => matchesMedia(query),
|
||||
() => false,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useMediaQuery } from './mediaQuery';
|
||||
|
||||
export const PREFERS_DARK_QUERY = '(prefers-color-scheme: dark)';
|
||||
|
||||
/** BR-U1-2/3: the system colour-scheme preference, live. */
|
||||
export function usePrefersDark(): boolean {
|
||||
return useMediaQuery(PREFERS_DARK_QUERY);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { useMediaQuery } from './mediaQuery';
|
||||
|
||||
export const REDUCED_MOTION_QUERY = '(prefers-reduced-motion: reduce)';
|
||||
|
||||
/** BR-U1-9: true when the visitor asks for less motion; all effects must then be skipped. */
|
||||
export function usePrefersReducedMotion(): boolean {
|
||||
return useMediaQuery(REDUCED_MOTION_QUERY);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { vi } from 'vitest';
|
||||
|
||||
type Listener = (event: { matches: boolean }) => void;
|
||||
|
||||
/**
|
||||
* Installs a controllable `window.matchMedia` (jsdom has none). `initial` maps a media query to
|
||||
* its current result; `set()` flips a query and notifies subscribers like a real change event.
|
||||
*/
|
||||
export function mockMatchMedia(initial: Record<string, boolean> = {}) {
|
||||
const state: Record<string, boolean> = { ...initial };
|
||||
const listeners = new Map<string, Set<Listener>>();
|
||||
|
||||
window.matchMedia = vi.fn((query: string) => ({
|
||||
get matches() {
|
||||
return Boolean(state[query]);
|
||||
},
|
||||
media: query,
|
||||
onchange: null,
|
||||
addEventListener: (_type: string, cb: Listener) => {
|
||||
if (!listeners.has(query)) listeners.set(query, new Set());
|
||||
listeners.get(query)!.add(cb);
|
||||
},
|
||||
removeEventListener: (_type: string, cb: Listener) => {
|
||||
listeners.get(query)?.delete(cb);
|
||||
},
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
})) as unknown as typeof window.matchMedia;
|
||||
|
||||
return {
|
||||
set(query: string, value: boolean) {
|
||||
state[query] = value;
|
||||
listeners.get(query)?.forEach((cb) => cb({ matches: value }));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** Restores the jsdom default: no `matchMedia` at all. */
|
||||
export function clearMatchMedia() {
|
||||
delete (window as unknown as { matchMedia?: unknown }).matchMedia;
|
||||
}
|
||||
@@ -1 +1,5 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
// jsdom does not implement window.scrollTo; the variant switch scrolls to the top (BR-U1-6).
|
||||
window.scrollTo = vi.fn() as unknown as typeof window.scrollTo;
|
||||
|
||||
+209
-31
@@ -1,55 +1,235 @@
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import {
|
||||
DEFAULT_THEME,
|
||||
THEME_STORAGE_KEY,
|
||||
resolveInitialTheme,
|
||||
themeClassName,
|
||||
type ThemeName,
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { matchesMedia } from '../shared/hooks/mediaQuery';
|
||||
import { PREFERS_DARK_QUERY, usePrefersDark } from '../shared/hooks/usePrefersDark';
|
||||
import { usePrefersReducedMotion } from '../shared/hooks/usePrefersReducedMotion';
|
||||
import {
|
||||
DEFAULT_VARIANT,
|
||||
LEGACY_THEME_STORAGE_KEY,
|
||||
MODE_STORAGE_KEY,
|
||||
otherMode,
|
||||
otherVariant,
|
||||
resolveInitialMode,
|
||||
type Mode,
|
||||
type ModeSource,
|
||||
type Variant,
|
||||
} from './tokens';
|
||||
|
||||
/** Phases of the time-travel transition (BR-U1-6). `idle` = nothing running. */
|
||||
export type TransitionPhase = 'idle' | 'cover' | 'swap' | 'reveal';
|
||||
|
||||
export interface TransitionState {
|
||||
phase: TransitionPhase;
|
||||
target: Variant | null;
|
||||
}
|
||||
|
||||
/** Duration of the cover and the reveal phase in ms (skipped under reduced motion, BR-U1-9). */
|
||||
export const TRANSITION_PHASE_MS = 300;
|
||||
|
||||
interface ThemeContextValue {
|
||||
theme: ThemeName;
|
||||
toggleTheme: () => void;
|
||||
variant: Variant;
|
||||
mode: Mode;
|
||||
modeSource: ModeSource;
|
||||
toggleMode: () => void;
|
||||
toggleVariant: () => void;
|
||||
transition: TransitionState;
|
||||
/** Text for the polite live region (BR-U1-7). */
|
||||
announcement: string;
|
||||
/** True when switching to E failed (chunk could not be loaded or E crashed), BR-U1-8. */
|
||||
variantError: boolean;
|
||||
retryVariant: () => void;
|
||||
dismissVariantError: () => void;
|
||||
/** Called by the E error boundary: falls back to B and shows the alert. */
|
||||
reportVariantError: () => void;
|
||||
}
|
||||
|
||||
const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
||||
|
||||
function readStoredTheme(): string | null {
|
||||
function readStoredMode(): string | null {
|
||||
try {
|
||||
return window.localStorage.getItem(THEME_STORAGE_KEY);
|
||||
return window.localStorage.getItem(MODE_STORAGE_KEY);
|
||||
} catch {
|
||||
// BR-3: treat unavailable/unreadable storage the same as "nothing stored" — fall back to default.
|
||||
// Treat unavailable/unreadable storage the same as "nothing stored".
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function persistTheme(theme: ThemeName): void {
|
||||
function persistMode(mode: Mode): void {
|
||||
try {
|
||||
window.localStorage.setItem(THEME_STORAGE_KEY, theme);
|
||||
window.localStorage.setItem(MODE_STORAGE_KEY, mode);
|
||||
} catch {
|
||||
// Ignore write failures (e.g. storage disabled) — theme still works for this session via state.
|
||||
// Ignore write failures (storage disabled): the mode still works for this session.
|
||||
}
|
||||
}
|
||||
|
||||
export function ThemeProvider({ children }: { children: ReactNode }) {
|
||||
const [theme, setTheme] = useState<ThemeName>(() => resolveInitialTheme(readStoredTheme()));
|
||||
function removeLegacyThemeKey(): void {
|
||||
try {
|
||||
window.localStorage.removeItem(LEGACY_THEME_STORAGE_KEY);
|
||||
} catch {
|
||||
// Nothing to clean up when storage is unavailable.
|
||||
}
|
||||
}
|
||||
|
||||
const ANNOUNCE_TO_E = 'Tijdreis-weergave geladen.';
|
||||
const ANNOUNCE_TO_B = 'Terug naar de moderne weergave.';
|
||||
|
||||
function wait(ms: number): Promise<void> {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
interface ThemeProviderProps {
|
||||
children: ReactNode;
|
||||
/**
|
||||
* Preloads what a variant needs before the swap (E is a lazy chunk). Rejecting keeps the
|
||||
* current variant and raises `variantError` (BR-U1-8). Default: nothing to load.
|
||||
*/
|
||||
loadVariant?: (variant: Variant) => Promise<unknown>;
|
||||
}
|
||||
|
||||
export function ThemeProvider({ children, loadVariant }: ThemeProviderProps) {
|
||||
const systemDark = usePrefersDark();
|
||||
const reducedMotion = usePrefersReducedMotion();
|
||||
|
||||
const [initial] = useState(() =>
|
||||
resolveInitialMode(readStoredMode(), matchesMedia(PREFERS_DARK_QUERY)),
|
||||
);
|
||||
const [variant, setVariant] = useState<Variant>(DEFAULT_VARIANT);
|
||||
const [mode, setMode] = useState<Mode>(initial.mode);
|
||||
const [modeSource, setModeSource] = useState<ModeSource>(initial.source);
|
||||
const [transition, setTransition] = useState<TransitionState>({ phase: 'idle', target: null });
|
||||
const [announcement, setAnnouncement] = useState('');
|
||||
const [variantError, setVariantError] = useState(false);
|
||||
|
||||
const busyRef = useRef(false);
|
||||
const mountedRef = useRef(true);
|
||||
|
||||
useEffect(() => {
|
||||
const root = document.documentElement;
|
||||
root.classList.remove('theme-red', 'theme-purple');
|
||||
root.classList.add(themeClassName(theme));
|
||||
}, [theme]);
|
||||
|
||||
const toggleTheme = useCallback(() => {
|
||||
setTheme((current) => {
|
||||
const next: ThemeName = current === 'red' ? 'purple' : 'red';
|
||||
persistTheme(next);
|
||||
return next;
|
||||
});
|
||||
mountedRef.current = true;
|
||||
return () => {
|
||||
mountedRef.current = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
const value = useMemo<ThemeContextValue>(() => ({ theme, toggleTheme }), [theme, toggleTheme]);
|
||||
// BR-U1-11: the red/purple key is obsolete.
|
||||
useEffect(() => {
|
||||
removeLegacyThemeKey();
|
||||
}, []);
|
||||
|
||||
// BR-U1-3: follow the system preference until the visitor has chosen.
|
||||
useEffect(() => {
|
||||
if (modeSource === 'system') {
|
||||
setMode(systemDark ? 'dark' : 'light');
|
||||
}
|
||||
}, [systemDark, modeSource]);
|
||||
|
||||
// Keep <html> in sync (theme-init.js already set the same values before first paint).
|
||||
useEffect(() => {
|
||||
const root = document.documentElement;
|
||||
root.setAttribute('data-variant', variant);
|
||||
root.setAttribute('data-mode', mode);
|
||||
root.classList.remove('theme-red', 'theme-purple');
|
||||
}, [variant, mode]);
|
||||
|
||||
const toggleMode = useCallback(() => {
|
||||
const next = otherMode(mode);
|
||||
setMode(next);
|
||||
setModeSource('user');
|
||||
persistMode(next);
|
||||
}, [mode]);
|
||||
|
||||
const runSwitch = useCallback(
|
||||
async (target: Variant) => {
|
||||
if (busyRef.current) {
|
||||
return;
|
||||
}
|
||||
busyRef.current = true;
|
||||
setVariantError(false);
|
||||
const phaseMs = reducedMotion ? 0 : TRANSITION_PHASE_MS;
|
||||
try {
|
||||
setTransition({ phase: 'cover', target });
|
||||
// The cover runs while the target variant loads; both must finish before the swap.
|
||||
await Promise.all([wait(phaseMs), loadVariant ? loadVariant(target) : Promise.resolve()]);
|
||||
if (!mountedRef.current) {
|
||||
return;
|
||||
}
|
||||
setVariant(target);
|
||||
setTransition({ phase: 'swap', target });
|
||||
// Let React render the new variant, then scroll/focus (BR-U1-6) and announce (BR-U1-7).
|
||||
await wait(0);
|
||||
window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
||||
document.getElementById('main')?.focus({ preventScroll: true });
|
||||
setAnnouncement(target === 'e' ? ANNOUNCE_TO_E : ANNOUNCE_TO_B);
|
||||
setTransition({ phase: 'reveal', target });
|
||||
await wait(phaseMs);
|
||||
} catch {
|
||||
// BR-U1-8: stay in the current variant and tell the visitor.
|
||||
if (mountedRef.current) {
|
||||
setVariantError(true);
|
||||
setAnnouncement('De tijdreis kon niet worden geladen.');
|
||||
}
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
if (mountedRef.current) {
|
||||
setTransition({ phase: 'idle', target: null });
|
||||
}
|
||||
}
|
||||
},
|
||||
[loadVariant, reducedMotion],
|
||||
);
|
||||
|
||||
const toggleVariant = useCallback(() => {
|
||||
void runSwitch(otherVariant(variant));
|
||||
}, [runSwitch, variant]);
|
||||
|
||||
const retryVariant = useCallback(() => {
|
||||
void runSwitch('e');
|
||||
}, [runSwitch]);
|
||||
|
||||
const dismissVariantError = useCallback(() => setVariantError(false), []);
|
||||
|
||||
const reportVariantError = useCallback(() => {
|
||||
setVariant(DEFAULT_VARIANT);
|
||||
setVariantError(true);
|
||||
setAnnouncement('De tijdreis kon niet worden geladen.');
|
||||
setTransition({ phase: 'idle', target: null });
|
||||
}, []);
|
||||
|
||||
const value = useMemo<ThemeContextValue>(
|
||||
() => ({
|
||||
variant,
|
||||
mode,
|
||||
modeSource,
|
||||
toggleMode,
|
||||
toggleVariant,
|
||||
transition,
|
||||
announcement,
|
||||
variantError,
|
||||
retryVariant,
|
||||
dismissVariantError,
|
||||
reportVariantError,
|
||||
}),
|
||||
[
|
||||
variant,
|
||||
mode,
|
||||
modeSource,
|
||||
toggleMode,
|
||||
toggleVariant,
|
||||
transition,
|
||||
announcement,
|
||||
variantError,
|
||||
retryVariant,
|
||||
dismissVariantError,
|
||||
reportVariantError,
|
||||
],
|
||||
);
|
||||
|
||||
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
|
||||
}
|
||||
@@ -61,5 +241,3 @@ export function useTheme(): ThemeContextValue {
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
export { DEFAULT_THEME };
|
||||
|
||||
@@ -1,63 +1,210 @@
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { ThemeProvider, useTheme } from '../ThemeProvider';
|
||||
import { THEME_STORAGE_KEY } from '../tokens';
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { ThemeProvider, TRANSITION_PHASE_MS, useTheme } from '../ThemeProvider';
|
||||
import { LEGACY_THEME_STORAGE_KEY, MODE_STORAGE_KEY } from '../tokens';
|
||||
import { clearMatchMedia, mockMatchMedia } from '../../test/matchMedia';
|
||||
import { PREFERS_DARK_QUERY } from '../../shared/hooks/usePrefersDark';
|
||||
import { REDUCED_MOTION_QUERY } from '../../shared/hooks/usePrefersReducedMotion';
|
||||
|
||||
function ThemeProbe() {
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
const t = useTheme();
|
||||
return (
|
||||
<div>
|
||||
<span data-testid="current-theme">{theme}</span>
|
||||
<button onClick={toggleTheme}>toggle</button>
|
||||
<span data-testid="variant">{t.variant}</span>
|
||||
<span data-testid="mode">{t.mode}</span>
|
||||
<span data-testid="source">{t.modeSource}</span>
|
||||
<span data-testid="phase">{t.transition.phase}</span>
|
||||
<span data-testid="announcement">{t.announcement}</span>
|
||||
<span data-testid="error">{String(t.variantError)}</span>
|
||||
<button onClick={t.toggleMode}>mode</button>
|
||||
<button onClick={t.toggleVariant}>variant</button>
|
||||
<button onClick={t.retryVariant}>retry</button>
|
||||
<main id="main" tabIndex={-1} data-testid="main" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function renderProvider(loadVariant?: (v: 'b' | 'e') => Promise<unknown>) {
|
||||
return render(
|
||||
<ThemeProvider loadVariant={loadVariant}>
|
||||
<ThemeProbe />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('ThemeProvider', () => {
|
||||
beforeEach(() => {
|
||||
window.localStorage.clear();
|
||||
document.documentElement.className = '';
|
||||
document.documentElement.removeAttribute('data-variant');
|
||||
document.documentElement.removeAttribute('data-mode');
|
||||
vi.mocked(window.scrollTo).mockClear();
|
||||
});
|
||||
afterEach(() => {
|
||||
clearMatchMedia();
|
||||
vi.restoreAllMocks();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('defaults to red when nothing is stored (BR-1)', () => {
|
||||
render(
|
||||
<ThemeProvider>
|
||||
<ThemeProbe />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
expect(screen.getByTestId('current-theme')).toHaveTextContent('red');
|
||||
expect(document.documentElement.classList.contains('theme-red')).toBe(true);
|
||||
describe('mode', () => {
|
||||
it('starts in B and follows the system preference when nothing is stored (BR-U1-1, 2)', () => {
|
||||
mockMatchMedia({ [PREFERS_DARK_QUERY]: true });
|
||||
renderProvider();
|
||||
expect(screen.getByTestId('variant')).toHaveTextContent('b');
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('dark');
|
||||
expect(screen.getByTestId('source')).toHaveTextContent('system');
|
||||
expect(document.documentElement).toHaveAttribute('data-variant', 'b');
|
||||
expect(document.documentElement).toHaveAttribute('data-mode', 'dark');
|
||||
});
|
||||
|
||||
it('uses light when the system preference is unavailable', () => {
|
||||
renderProvider();
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('light');
|
||||
});
|
||||
|
||||
it('prefers a valid stored mode over the system preference', () => {
|
||||
mockMatchMedia({ [PREFERS_DARK_QUERY]: true });
|
||||
window.localStorage.setItem(MODE_STORAGE_KEY, 'light');
|
||||
renderProvider();
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('light');
|
||||
expect(screen.getByTestId('source')).toHaveTextContent('user');
|
||||
});
|
||||
|
||||
it('ignores an invalid stored mode', () => {
|
||||
window.localStorage.setItem(MODE_STORAGE_KEY, 'purple');
|
||||
renderProvider();
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('light');
|
||||
expect(screen.getByTestId('source')).toHaveTextContent('system');
|
||||
});
|
||||
|
||||
it('removes the legacy red/purple key once (BR-U1-11)', () => {
|
||||
window.localStorage.setItem(LEGACY_THEME_STORAGE_KEY, 'purple');
|
||||
renderProvider();
|
||||
expect(window.localStorage.getItem(LEGACY_THEME_STORAGE_KEY)).toBeNull();
|
||||
});
|
||||
|
||||
it('follows system changes until the visitor clicks (BR-U1-3)', () => {
|
||||
const media = mockMatchMedia({ [PREFERS_DARK_QUERY]: false });
|
||||
renderProvider();
|
||||
act(() => media.set(PREFERS_DARK_QUERY, true));
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('dark');
|
||||
|
||||
fireEvent.click(screen.getByText('mode'));
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('light');
|
||||
expect(screen.getByTestId('source')).toHaveTextContent('user');
|
||||
|
||||
act(() => media.set(PREFERS_DARK_QUERY, false));
|
||||
act(() => media.set(PREFERS_DARK_QUERY, true));
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('light');
|
||||
});
|
||||
|
||||
it('persists the chosen mode and updates <html> (BR-U1-4)', () => {
|
||||
renderProvider();
|
||||
fireEvent.click(screen.getByText('mode'));
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('dark');
|
||||
expect(window.localStorage.getItem(MODE_STORAGE_KEY)).toBe('dark');
|
||||
expect(document.documentElement).toHaveAttribute('data-mode', 'dark');
|
||||
});
|
||||
|
||||
it('still toggles when storage is unavailable (BR-U1-4)', () => {
|
||||
vi.spyOn(Storage.prototype, 'setItem').mockImplementation(() => {
|
||||
throw new Error('blocked');
|
||||
});
|
||||
vi.spyOn(Storage.prototype, 'getItem').mockImplementation(() => {
|
||||
throw new Error('blocked');
|
||||
});
|
||||
renderProvider();
|
||||
fireEvent.click(screen.getByText('mode'));
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('dark');
|
||||
});
|
||||
});
|
||||
|
||||
it('persists the chosen theme to localStorage on toggle (BR-2)', () => {
|
||||
render(
|
||||
<ThemeProvider>
|
||||
<ThemeProbe />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
fireEvent.click(screen.getByText('toggle'));
|
||||
expect(screen.getByTestId('current-theme')).toHaveTextContent('purple');
|
||||
expect(window.localStorage.getItem(THEME_STORAGE_KEY)).toBe('purple');
|
||||
expect(document.documentElement.classList.contains('theme-purple')).toBe(true);
|
||||
});
|
||||
describe('variant', () => {
|
||||
it('never stores the variant (BR-U1-1)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderProvider(() => Promise.resolve());
|
||||
fireEvent.click(screen.getByText('variant'));
|
||||
await waitFor(() => expect(screen.getByTestId('variant')).toHaveTextContent('e'));
|
||||
await waitFor(() => expect(screen.getByTestId('phase')).toHaveTextContent('idle'));
|
||||
expect(window.localStorage.length).toBe(0);
|
||||
});
|
||||
|
||||
it('falls back to the default theme when the stored value is invalid (BR-3)', () => {
|
||||
window.localStorage.setItem(THEME_STORAGE_KEY, 'blue');
|
||||
render(
|
||||
<ThemeProvider>
|
||||
<ThemeProbe />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
expect(screen.getByTestId('current-theme')).toHaveTextContent('red');
|
||||
});
|
||||
it('switches to E, scrolls to the top, focuses main and announces (BR-U1-6, 7)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderProvider(() => Promise.resolve());
|
||||
fireEvent.click(screen.getByText('variant'));
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('announcement')).toHaveTextContent('Tijdreis-weergave geladen.'),
|
||||
);
|
||||
expect(screen.getByTestId('variant')).toHaveTextContent('e');
|
||||
expect(window.scrollTo).toHaveBeenCalledWith({ top: 0, left: 0, behavior: 'instant' });
|
||||
expect(document.activeElement).toBe(screen.getByTestId('main'));
|
||||
expect(document.documentElement).toHaveAttribute('data-variant', 'e');
|
||||
|
||||
it('uses a valid stored theme on load', () => {
|
||||
window.localStorage.setItem(THEME_STORAGE_KEY, 'purple');
|
||||
render(
|
||||
<ThemeProvider>
|
||||
<ThemeProbe />
|
||||
</ThemeProvider>,
|
||||
);
|
||||
expect(screen.getByTestId('current-theme')).toHaveTextContent('purple');
|
||||
await waitFor(() => expect(screen.getByTestId('phase')).toHaveTextContent('idle'));
|
||||
fireEvent.click(screen.getByText('variant'));
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('announcement')).toHaveTextContent(
|
||||
'Terug naar de moderne weergave.',
|
||||
),
|
||||
);
|
||||
expect(screen.getByTestId('variant')).toHaveTextContent('b');
|
||||
});
|
||||
|
||||
it('keeps the mode when switching variant (BR-U1-10)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
renderProvider(() => Promise.resolve());
|
||||
fireEvent.click(screen.getByText('mode'));
|
||||
fireEvent.click(screen.getByText('variant'));
|
||||
await waitFor(() => expect(screen.getByTestId('variant')).toHaveTextContent('e'));
|
||||
expect(screen.getByTestId('mode')).toHaveTextContent('dark');
|
||||
});
|
||||
|
||||
it('runs cover -> swap -> reveal -> idle with the dither timings (BR-U1-6)', async () => {
|
||||
vi.useFakeTimers();
|
||||
mockMatchMedia();
|
||||
let release: () => void = () => {};
|
||||
const load = vi.fn(() => new Promise<void>((resolve) => (release = resolve)));
|
||||
renderProvider(load);
|
||||
|
||||
fireEvent.click(screen.getByText('variant'));
|
||||
expect(screen.getByTestId('phase')).toHaveTextContent('cover');
|
||||
expect(load).toHaveBeenCalledWith('e');
|
||||
|
||||
// The cover time alone is not enough: the chunk must be loaded as well.
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(TRANSITION_PHASE_MS);
|
||||
});
|
||||
expect(screen.getByTestId('variant')).toHaveTextContent('b');
|
||||
|
||||
await act(async () => {
|
||||
release();
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
});
|
||||
expect(screen.getByTestId('variant')).toHaveTextContent('e');
|
||||
expect(screen.getByTestId('phase')).toHaveTextContent('reveal');
|
||||
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(TRANSITION_PHASE_MS);
|
||||
});
|
||||
expect(screen.getByTestId('phase')).toHaveTextContent('idle');
|
||||
});
|
||||
|
||||
it('stays in B and reports an error when loading E fails, retry works (BR-U1-8)', async () => {
|
||||
mockMatchMedia({ [REDUCED_MOTION_QUERY]: true });
|
||||
const load = vi
|
||||
.fn<(v: 'b' | 'e') => Promise<unknown>>()
|
||||
.mockRejectedValueOnce(new Error('chunk failed'))
|
||||
.mockResolvedValue(undefined);
|
||||
renderProvider(load);
|
||||
|
||||
fireEvent.click(screen.getByText('variant'));
|
||||
await waitFor(() => expect(screen.getByTestId('error')).toHaveTextContent('true'));
|
||||
expect(screen.getByTestId('variant')).toHaveTextContent('b');
|
||||
expect(screen.getByTestId('phase')).toHaveTextContent('idle');
|
||||
|
||||
fireEvent.click(screen.getByText('retry'));
|
||||
await waitFor(() => expect(screen.getByTestId('variant')).toHaveTextContent('e'));
|
||||
expect(screen.getByTestId('error')).toHaveTextContent('false');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { isValidMode, otherMode, otherVariant, resolveInitialMode } from '../tokens';
|
||||
|
||||
describe('resolveInitialMode (BR-U1-2)', () => {
|
||||
it.each([
|
||||
['light', true, 'light', 'user'],
|
||||
['dark', false, 'dark', 'user'],
|
||||
[null, true, 'dark', 'system'],
|
||||
[null, false, 'light', 'system'],
|
||||
['blue', true, 'dark', 'system'],
|
||||
['', false, 'light', 'system'],
|
||||
['purple', false, 'light', 'system'],
|
||||
] as const)('stored=%s systemDark=%s -> %s (%s)', (stored, systemDark, mode, source) => {
|
||||
expect(resolveInitialMode(stored, systemDark)).toEqual({ mode, source });
|
||||
});
|
||||
});
|
||||
|
||||
describe('helpers', () => {
|
||||
it('validates only light and dark', () => {
|
||||
expect(isValidMode('light')).toBe(true);
|
||||
expect(isValidMode('dark')).toBe(true);
|
||||
expect(isValidMode('red')).toBe(false);
|
||||
expect(isValidMode(undefined)).toBe(false);
|
||||
});
|
||||
|
||||
it('flips mode and variant', () => {
|
||||
expect(otherMode('light')).toBe('dark');
|
||||
expect(otherMode('dark')).toBe('light');
|
||||
expect(otherVariant('b')).toBe('e');
|
||||
expect(otherVariant('e')).toBe('b');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { Variant } from './tokens';
|
||||
|
||||
/**
|
||||
* Preloads the code of a variant before the transition swaps to it (BR-U1-8). B is part of the
|
||||
* main bundle; E is a separate chunk. The same dynamic import is used by VariantRenderer, so the
|
||||
* module is cached and the lazy component resolves immediately after the swap.
|
||||
*/
|
||||
export function loadVariant(variant: Variant): Promise<unknown> {
|
||||
return variant === 'e' ? import('../variants/e/LandingE') : Promise.resolve();
|
||||
}
|
||||
+34
-18
@@ -1,30 +1,46 @@
|
||||
/**
|
||||
* Theme values (BR-3: only 'red' and 'purple' are valid).
|
||||
* Actual token colors live in src/index.css (.theme-red / .theme-purple);
|
||||
* this module only owns the *selectable* theme identifiers and the
|
||||
* localStorage key used for persistence (BR-2).
|
||||
* Theme model: variant (B = modern default, E = time-travel easter egg) x mode (light | dark).
|
||||
* Actual token colors live in src/index.css (html[data-variant][data-mode]); this module only
|
||||
* owns the identifiers, the storage keys and the pure rules for the initial mode.
|
||||
*
|
||||
* Rules: see aidlc-docs/features/redesign-modern-timetravel/construction/theme-foundation/
|
||||
* functional-design/business-rules.md (BR-U1-1 .. BR-U1-12).
|
||||
*/
|
||||
|
||||
export type ThemeName = 'red' | 'purple';
|
||||
export type Variant = 'b' | 'e';
|
||||
export type Mode = 'light' | 'dark';
|
||||
/** `system` until the visitor clicks the mode button, `user` afterwards (BR-U1-3/4). */
|
||||
export type ModeSource = 'system' | 'user';
|
||||
|
||||
export const THEMES: ThemeName[] = ['red', 'purple'];
|
||||
/** BR-U1-1: every page load starts in B; the variant is never stored and not in the URL. */
|
||||
export const DEFAULT_VARIANT: Variant = 'b';
|
||||
|
||||
export const DEFAULT_THEME: ThemeName = 'red';
|
||||
export const MODE_STORAGE_KEY = 'slp-software-mode';
|
||||
/** Key of the former red/purple theme; ignored and removed once (BR-U1-11). */
|
||||
export const LEGACY_THEME_STORAGE_KEY = 'slp-software-theme';
|
||||
|
||||
export const THEME_STORAGE_KEY = 'slp-software-theme';
|
||||
|
||||
/** BR-3: fall back to the default theme for anything that isn't a valid ThemeName. */
|
||||
export function isValidTheme(value: unknown): value is ThemeName {
|
||||
return value === 'red' || value === 'purple';
|
||||
export function isValidMode(value: unknown): value is Mode {
|
||||
return value === 'light' || value === 'dark';
|
||||
}
|
||||
|
||||
export function resolveInitialTheme(storedValue: string | null): ThemeName {
|
||||
if (isValidTheme(storedValue)) {
|
||||
return storedValue;
|
||||
/**
|
||||
* BR-U1-2: a valid stored mode wins; otherwise the system preference decides.
|
||||
* Must stay in sync with public/theme-init.js, which runs this same rule before first paint.
|
||||
*/
|
||||
export function resolveInitialMode(
|
||||
stored: string | null,
|
||||
systemPrefersDark: boolean,
|
||||
): { mode: Mode; source: ModeSource } {
|
||||
if (isValidMode(stored)) {
|
||||
return { mode: stored, source: 'user' };
|
||||
}
|
||||
return DEFAULT_THEME;
|
||||
return { mode: systemPrefersDark ? 'dark' : 'light', source: 'system' };
|
||||
}
|
||||
|
||||
export function themeClassName(theme: ThemeName): string {
|
||||
return `theme-${theme}`;
|
||||
export function otherVariant(variant: Variant): Variant {
|
||||
return variant === 'b' ? 'e' : 'b';
|
||||
}
|
||||
|
||||
export function otherMode(mode: Mode): Mode {
|
||||
return mode === 'light' ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { ModeToggle } from '../../components/ui/ModeToggle';
|
||||
import { VariantToggle } from '../../components/ui/VariantToggle';
|
||||
|
||||
/**
|
||||
* Placeholder shell for variant E (time-travel). The real content (eras 2026 / 2013 / 2006 /
|
||||
* 1998 / 1989) is built in unit U5; U1 only provides the lazy chunk and the way back to B.
|
||||
*/
|
||||
export default function LandingE() {
|
||||
return (
|
||||
<>
|
||||
<nav className="sticky top-0 z-50 border-b border-line bg-bg/80 backdrop-blur-md">
|
||||
<div className="mx-auto flex h-16 max-w-[1080px] items-center justify-between px-6">
|
||||
<span className="font-mono text-base font-bold tracking-wide text-text">
|
||||
SLP<span className="text-accent">.</span>Software
|
||||
</span>
|
||||
<ul className="flex items-center gap-4">
|
||||
<li>
|
||||
<ModeToggle />
|
||||
</li>
|
||||
<li>
|
||||
<VariantToggle />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<main id="main" tabIndex={-1} className="mx-auto max-w-[1080px] px-6 py-24 outline-none">
|
||||
<h1 className="font-display text-4xl font-extrabold">Tijdreis</h1>
|
||||
<p className="mt-4 text-muted">Deze weergave is in aanbouw.</p>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user