Extends the shared blocks for the shoot types page

FramedImage and MediaText take a colour for the block behind the photo
(sand by default) and MediaText can put the photo in the right-hand
column from lg, without changing the reading order. RichParagraph moves
to the shared components, a new CallToAction closes a page with a
heading, lead and action, and the homepage pricing section gets the
anchor #prijzen. A test helper reads the generated CSS rules, since
jsdom applies neither media queries nor pseudo-elements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 08:25:27 +01:00
co-authored by Claude Opus 5.5
parent befe97af1e
commit 6cf909564b
12 changed files with 251 additions and 12 deletions
@@ -2,6 +2,7 @@ import { screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import type { ContentImage } from '@/content/types';
import { axeResults } from '@/test/axe';
import { cssRulesFor } from '@/test/cssRules';
import { renderWithProviders } from '@/test/renderWithProviders';
import MediaText from './MediaText';
@@ -43,4 +44,44 @@ describe('MediaText', () => {
Node.DOCUMENT_POSITION_FOLLOWING,
).toBeTruthy();
});
const photoColumnRules = () =>
cssRulesFor(screen.getByRole('img').closest('[data-reveal]')!);
it('keeps the photo in the first column by default', async () => {
await renderWithProviders(
<MediaText image={image} aspectRatio="4 / 3">
<h2>Hoi! Ik ben Andrea</h2>
</MediaText>,
);
expect(photoColumnRules().join()).not.toContain('order');
});
it('moves the photo to the second column from lg when reversed, without changing the reading order', async () => {
await renderWithProviders(
<MediaText image={image} aspectRatio="4 / 5" reverse>
<h2>Newborn</h2>
</MediaText>,
);
expect(photoColumnRules()).toContainEqual(
expect.stringMatching(/min-width: 64rem.*order: 2;/),
);
const photo = screen.getByRole('img');
const heading = screen.getByRole('heading');
expect(
photo.compareDocumentPosition(heading) &
Node.DOCUMENT_POSITION_FOLLOWING,
).toBeTruthy();
});
it('passes the frame colour on to the photo', async () => {
await renderWithProviders(
<MediaText image={image} aspectRatio="4 / 5" frameColor="accent">
<h2>Gezin</h2>
</MediaText>,
);
expect(
cssRulesFor(screen.getByRole('img').parentElement!).join(),
).toContain('var(--slp-colors-accent)');
});
});
+12 -4
View File
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
import { Grid } from '@chakra-ui/react';
import FramedImage from '@/components/FramedImage/FramedImage';
import Reveal from '@/components/Reveal/Reveal';
import type { ContentImage } from '@/content/types';
import type { ContentImage, FrameColor } from '@/content/types';
type MediaTextProps = {
image: ContentImage;
@@ -10,18 +10,25 @@ type MediaTextProps = {
aspectRatio: string;
// The photo is at the top of the page and should not wait (FramedImage)
priority?: boolean;
// Photo in the right-hand column from `lg` (design .about--reverse).
// Only the visual order changes: the photo stays first in the DOM.
reverse?: boolean;
// Colour of the block behind the photo (FramedImage)
frameColor?: FrameColor;
'data-testid'?: string;
// The text column; each page fills in its own heading and text
children: ReactNode;
};
// A framed photo next to a text column (design .about), used on the
// homepage and the about page. Stacked on phones and tablets, two equal
// columns from `lg`; both columns fade in on scroll.
// homepage, the about page and the shoot types page. Stacked on phones and
// tablets, two equal columns from `lg`; both columns fade in on scroll.
export default function MediaText({
image,
aspectRatio,
priority,
reverse = false,
frameColor,
'data-testid': testId,
children,
}: MediaTextProps) {
@@ -32,11 +39,12 @@ export default function MediaText({
alignItems="center"
data-testid={testId}
>
<Reveal>
<Reveal order={reverse ? { lg: 2 } : undefined}>
<FramedImage
image={image}
aspectRatio={aspectRatio}
priority={priority}
frameColor={frameColor}
/>
</Reveal>
<Reveal>{children}</Reveal>