Files
AndreaSlopFotografie/web/src/lib/mosaicLayout.ts
SluijsensandClaude Opus 5.5 7af2069959 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>
2026-10-30 14:43:43 +01:00

51 lines
1.8 KiB
TypeScript

// The photo mosaic of a shoot page: a 4 x 2 grid from `md`, two columns on
// phones (FR-ST-05). Each tile says where it sits; the component only
// draws them.
// The most photos the mosaic shows; more stay in the content
export const MOSAIC_MAX_PHOTOS = 4;
export interface MosaicTile {
// CSS grid-column from `md`, e.g. '1 / 3'
column: string;
// CSS grid-row from `md`
row: string;
// Spans both columns below `md`
wide: boolean;
// Aspect ratio of the tile below `md`
phoneRatio: '4 / 3' | '3 / 2' | '1 / 1';
}
const large: MosaicTile = {
column: '1 / 3',
row: '1 / 3',
wide: true,
phoneRatio: '4 / 3',
};
const layouts: Record<1 | 2 | 3 | 4, readonly MosaicTile[]> = {
// Never shown (the view needs at least two photos), kept so that the
// function is total
1: [{ column: '1 / 5', row: '1 / 3', wide: true, phoneRatio: '4 / 3' }],
2: [large, { ...large, column: '3 / 5' }],
3: [
large,
{ column: '3 / 5', row: '1 / 2', wide: true, phoneRatio: '3 / 2' },
{ column: '3 / 5', row: '2 / 3', wide: true, phoneRatio: '3 / 2' },
],
4: [
large,
{ column: '3 / 5', row: '1 / 2', wide: true, phoneRatio: '3 / 2' },
{ column: '3 / 4', row: '2 / 3', wide: false, phoneRatio: '1 / 1' },
{ column: '4 / 5', row: '2 / 3', wide: false, phoneRatio: '1 / 1' },
],
};
// The tiles for `count` photos. Nothing for a count below 1 or one that is
// not a whole number (fail safe); five or more get the layout for four.
export function mosaicLayout(count: number): MosaicTile[] {
if (!Number.isInteger(count) || count < 1) return [];
const key = Math.min(count, MOSAIC_MAX_PHOTOS) as 1 | 2 | 3 | 4;
return layouts[key].map((tile) => ({ ...tile }));
}