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>
25 lines
961 B
TypeScript
25 lines
961 B
TypeScript
import type { NavItem } from '../navigation.ts';
|
|
|
|
// Lower case and without one trailing slash (not for "/"), the way the
|
|
// router matches a path (BR-NAV-04)
|
|
function normalise(path: string): string {
|
|
const lower = path.toLowerCase();
|
|
return lower.length > 1 && lower.endsWith('/') ? lower.slice(0, -1) : lower;
|
|
}
|
|
|
|
// Whether the item is the page at `pathname`. Pure string comparison: never
|
|
// throws and never renders the pathname (SECURITY-05, SECURITY-15).
|
|
export function isItemCurrent(item: NavItem, pathname: string): boolean {
|
|
return normalise(item.to) === normalise(pathname);
|
|
}
|
|
|
|
// Whether the item or one of its children is the page at `pathname`; marks
|
|
// the parent while a page below it is open (D4)
|
|
export function isSectionCurrent(item: NavItem, pathname: string): boolean {
|
|
return (
|
|
isItemCurrent(item, pathname) ||
|
|
(item.children?.some((child) => isItemCurrent(child, pathname)) ??
|
|
false)
|
|
);
|
|
}
|