Adds the shoot page layout and the shoot-type submenu
Shoot pages follow design E: breadcrumb, story blocks, process timeline with icons, photo mosaic, FAQ, package block and booking call to action, with per-shoot OG images. The navigation gets a "Soorten fotoshoots" submenu (desktop panel, mobile group) built from shootTypes, with exact current-page matching in menu, footer and breadcrumb. A 404 under /soorten-fotoshoots/ also offers a link back to the overview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,45 @@
|
||||
import { useRouterState } from '@tanstack/react-router';
|
||||
import { isShootSectionPath } from '@/lib/isShootSectionPath';
|
||||
import LinkButton from '../LinkButton';
|
||||
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).
|
||||
// Onder /soorten-fotoshoots/ komt er een knop naar het overzicht bij
|
||||
// (FR-ST-14).
|
||||
export default function NotFound() {
|
||||
const pathname = useRouterState({
|
||||
select: (routerState) => routerState.location.pathname,
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<title>Pagina niet gevonden | Andrea Slop Fotografie</title>
|
||||
<meta name="robots" content="noindex" />
|
||||
<StatusPage title="Pagina niet gevonden">
|
||||
<StatusPage
|
||||
title="Pagina niet gevonden"
|
||||
actions={
|
||||
isShootSectionPath(pathname) ? (
|
||||
<>
|
||||
<LinkButton
|
||||
to="/soorten-fotoshoots"
|
||||
variant="accent"
|
||||
data-testid="status-page-section-link"
|
||||
>
|
||||
Terug naar Soorten fotoshoots
|
||||
</LinkButton>
|
||||
<LinkButton
|
||||
to="/"
|
||||
variant="outline"
|
||||
data-testid="status-page-home-link"
|
||||
>
|
||||
Terug naar home
|
||||
</LinkButton>
|
||||
</>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
Deze pagina bestaat niet (meer). Misschien is de link verouderd
|
||||
of zit er een typfout in het adres.
|
||||
</StatusPage>
|
||||
|
||||
@@ -29,6 +29,35 @@ describe('NotFound', () => {
|
||||
document.head.querySelector('meta[name="robots"]'),
|
||||
).toHaveAttribute('content', 'noindex');
|
||||
});
|
||||
|
||||
it('toont onder /soorten-fotoshoots/ twee knoppen in vaste volgorde', async () => {
|
||||
const { container } = await renderWithProviders(<NotFound />, {
|
||||
path: '/soorten-fotoshoots/niet-bestaande-shoot',
|
||||
});
|
||||
const links = screen.getAllByRole('link');
|
||||
expect(links.map((link) => link.textContent)).toEqual([
|
||||
'Terug naar Soorten fotoshoots',
|
||||
'Terug naar home',
|
||||
]);
|
||||
expect(links[0]).toHaveAttribute('href', '/soorten-fotoshoots');
|
||||
expect(links[1]).toHaveAttribute('href', '/');
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('herkent het prefix hoofdletterongevoelig', async () => {
|
||||
await renderWithProviders(<NotFound />, {
|
||||
path: '/Soorten-Fotoshoots/x',
|
||||
});
|
||||
expect(screen.getAllByRole('link')).toHaveLength(2);
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Terug naar Soorten fotoshoots' }),
|
||||
).toHaveAttribute('href', '/soorten-fotoshoots');
|
||||
});
|
||||
|
||||
it('houdt buiten de sectie één knop', async () => {
|
||||
await renderWithProviders(<NotFound />, { path: '/bestaat-niet' });
|
||||
expect(screen.getAllByRole('link')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ErrorPage', () => {
|
||||
|
||||
Reference in New Issue
Block a user