46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import shootTypes from './content/shootTypes.ts';
|
|
import { t } from './i18n/index.ts';
|
|
import { shootNavItems } from './lib/shootNavItems.ts';
|
|
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. De
|
|
// vangroute voor onbekende URL's is geen pagina: niet in menu's en register.
|
|
export type RoutePath = Exclude<keyof FileRoutesByTo, '/$'>;
|
|
|
|
export interface NavItem {
|
|
to: RoutePath;
|
|
label: string;
|
|
// Sub-pages, one level only; an empty array counts as none
|
|
children?: readonly NavItem[];
|
|
}
|
|
|
|
// Whether the item has a submenu (a non-empty list of children)
|
|
export function hasChildren(
|
|
item: NavItem,
|
|
): item is NavItem & { children: readonly NavItem[] } {
|
|
return (item.children?.length ?? 0) > 0;
|
|
}
|
|
|
|
// Hoofdmenu: desktopnavigatie en mobiel menu
|
|
export const mainNav: readonly NavItem[] = [
|
|
{ to: '/', label: t('site.nav.items.home') },
|
|
{ to: '/over-mij', label: t('site.nav.items.about') },
|
|
{ to: '/portfolio', label: t('site.nav.items.portfolio') },
|
|
{
|
|
to: '/soorten-fotoshoots',
|
|
label: t('site.nav.items.shoots'),
|
|
// One source: a new shoot type shows up in the menu by itself (D5)
|
|
children: shootNavItems(shootTypes),
|
|
},
|
|
{ to: '/contact', label: t('site.nav.items.contact') },
|
|
];
|
|
|
|
// Menu in de onderste footerbalk
|
|
export const footerNav: readonly NavItem[] = [
|
|
{ to: '/portfolio', label: t('site.nav.items.portfolio') },
|
|
{ to: '/soorten-fotoshoots', label: t('site.nav.items.shoots') },
|
|
{ to: '/contact', label: t('site.nav.items.contact') },
|
|
{ to: '/privacyverklaring', label: t('site.nav.items.privacy') },
|
|
];
|