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:
@@ -0,0 +1,95 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import LinkButton from '@/components/LinkButton';
|
||||
import packages from '@/content/packages';
|
||||
import shootTypes from '@/content/shootTypes';
|
||||
import type { PricingPackage } from '@/content/types';
|
||||
import { formatPrice } from '@/lib/formatPrice';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import PackageBlock from './PackageBlock';
|
||||
|
||||
const newborn = shootTypes.find((shoot) => shoot.id === 'newborn')!;
|
||||
const pkg: PricingPackage = packages.find(
|
||||
(item) => item.id === newborn.packageId,
|
||||
)!;
|
||||
const onRequest = { price: 'Prijs op aanvraag', text: 'Neem contact op.' };
|
||||
|
||||
describe('PackageBlock', () => {
|
||||
it('shows the price, the features, the actions and the note for a package', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<PackageBlock
|
||||
titleId="offer-title"
|
||||
eyebrow="Het pakket"
|
||||
title="Newbornshoot"
|
||||
image={newborn.image}
|
||||
pkg={pkg}
|
||||
onRequest={onRequest}
|
||||
note="Aanbetaling € 50."
|
||||
data-testid="package"
|
||||
>
|
||||
<LinkButton variant="accent" to="/contact">
|
||||
Boek dit pakket
|
||||
</LinkButton>
|
||||
<a href="/contact">Eerst een vraag stellen</a>
|
||||
</PackageBlock>,
|
||||
);
|
||||
expect(screen.getByRole('heading', { level: 2 })).toHaveAttribute(
|
||||
'id',
|
||||
'offer-title',
|
||||
);
|
||||
// The price keeps its non-breaking space
|
||||
const price = screen.getByText(/185/);
|
||||
expect(price.textContent).toBe(formatPrice(pkg.price));
|
||||
expect(price.textContent).toBe('€ 185');
|
||||
const list = screen.getByRole('list');
|
||||
const rows = within(list).getAllByRole('listitem');
|
||||
expect(rows.map((row) => row.textContent)).toEqual(pkg.features);
|
||||
expect(screen.queryByText(onRequest.text)).toBeNull();
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Boek dit pakket' }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'Eerst een vraag stellen' }),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText('Aanbetaling € 50.')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('package')).toBeInTheDocument();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('shows the on-request price and text, without a list, when there is no package', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<PackageBlock
|
||||
titleId="offer-title"
|
||||
eyebrow="Het aanbod"
|
||||
title="Loveshoot"
|
||||
image={newborn.image}
|
||||
onRequest={onRequest}
|
||||
>
|
||||
<LinkButton variant="accent" to="/contact">
|
||||
Vraag naar de mogelijkheden
|
||||
</LinkButton>
|
||||
</PackageBlock>,
|
||||
);
|
||||
expect(screen.getByText('Prijs op aanvraag')).toBeInTheDocument();
|
||||
expect(screen.getByText('Neem contact op.')).toBeInTheDocument();
|
||||
expect(screen.queryByRole('list')).toBeNull();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('leaves out the note when there is none', async () => {
|
||||
await renderWithProviders(
|
||||
<PackageBlock
|
||||
titleId="t"
|
||||
eyebrow="e"
|
||||
title="Titel"
|
||||
image={newborn.image}
|
||||
pkg={pkg}
|
||||
onRequest={onRequest}
|
||||
>
|
||||
<a href="/contact">Actie</a>
|
||||
</PackageBlock>,
|
||||
);
|
||||
expect(screen.queryByText(/Aanbetaling/)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,94 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, Flex, Heading, Text } from '@chakra-ui/react';
|
||||
import Eyebrow from '@/components/Eyebrow/Eyebrow';
|
||||
import MediaText from '@/components/MediaText/MediaText';
|
||||
import type { ContentImage, FrameColor, PricingPackage } from '@/content/types';
|
||||
import { formatPrice } from '@/lib/formatPrice';
|
||||
|
||||
type PackageBlockProps = {
|
||||
// Id of the h2, which names the section around the block
|
||||
titleId: string;
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
image: ContentImage;
|
||||
frameColor?: FrameColor;
|
||||
// Present: the price and the features. Absent: the on-request text.
|
||||
pkg?: PricingPackage;
|
||||
onRequest: { price: string; text: string };
|
||||
// Small print below the actions, e.g. the deposit
|
||||
note?: string;
|
||||
'data-testid'?: string;
|
||||
// The actions below the text, e.g. link buttons
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
// The offer of a shoot page (FR-ST-07, BR-SP-60..62): a small square photo
|
||||
// next to the price and either the features of the package or the text for
|
||||
// a shoot without a fixed price. The variant follows from `pkg` alone.
|
||||
export default function PackageBlock({
|
||||
titleId,
|
||||
eyebrow,
|
||||
title,
|
||||
image,
|
||||
frameColor,
|
||||
pkg,
|
||||
onRequest,
|
||||
note,
|
||||
'data-testid': testId,
|
||||
children,
|
||||
}: PackageBlockProps) {
|
||||
return (
|
||||
<MediaText
|
||||
image={image}
|
||||
aspectRatio="1 / 1"
|
||||
mediaSize="small"
|
||||
frameColor={frameColor}
|
||||
data-testid={testId}
|
||||
>
|
||||
<Eyebrow>{eyebrow}</Eyebrow>
|
||||
<Heading as="h2" id={titleId} textStyle="sectionTitle">
|
||||
{title}
|
||||
</Heading>
|
||||
<Text
|
||||
fontFamily="heading"
|
||||
fontSize="2.25rem"
|
||||
lineHeight="1.2"
|
||||
color="accent.deep"
|
||||
mt={4}
|
||||
>
|
||||
{pkg ? formatPrice(pkg.price) : onRequest.price}
|
||||
</Text>
|
||||
{pkg ? (
|
||||
<Box as="ul" role="list" listStyle="none" m={0} p={0} mt={5}>
|
||||
{pkg.features.map((feature, index) => (
|
||||
<Box
|
||||
as="li"
|
||||
key={`${index}-${feature}`}
|
||||
py={3}
|
||||
color="ink.soft"
|
||||
borderTopWidth="1px"
|
||||
borderColor="sand"
|
||||
borderBottomWidth={
|
||||
index === pkg.features.length - 1 ? '1px' : 0
|
||||
}
|
||||
>
|
||||
{feature}
|
||||
</Box>
|
||||
))}
|
||||
</Box>
|
||||
) : (
|
||||
<Text color="ink.soft" mt={4}>
|
||||
{onRequest.text}
|
||||
</Text>
|
||||
)}
|
||||
<Flex wrap="wrap" align="center" columnGap={7} rowGap={3} mt={7}>
|
||||
{children}
|
||||
</Flex>
|
||||
{note && (
|
||||
<Text fontSize="0.875rem" color="ink.soft" mt={5}>
|
||||
{note}
|
||||
</Text>
|
||||
)}
|
||||
</MediaText>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user