Makes the shoot blocks smaller and livelier

At the owner's review: the shoot photos are smaller (MediaText's new
`small` size), each shoot gets a square detail photo overlapping the
main one, and the text, now at most 36rem wide, sits centred between
the photos and the edge. Every shoot has its own band, alternating
paper and paper.alt, instead of a hairline. Existing MediaText callers
are unchanged. The route test expects the portfolio links once the
portfolio page is indexed, so it stays green when that page goes live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 16:23:52 +01:00
co-authored by Claude Opus 5.5
parent ce2cb92539
commit d2c1d2c1c4
14 changed files with 253 additions and 44 deletions
@@ -30,9 +30,14 @@ describe('ShootBlock', () => {
expect(
within(article).getByRole('heading', { level: 2 }),
).toHaveTextContent('Newborn');
expect(within(article).getByRole('img')).toHaveAccessibleName(
expect(
within(article)
.getAllByRole('img')
.map((img) => img.getAttribute('alt')),
).toEqual([
shoot('newborn').image.alt,
);
shoot('newborn').detailImage!.alt,
]);
expect(
within(article).getByText(/De fotoshoot vindt bij jou thuis/),
).toBeInTheDocument();
@@ -68,8 +73,10 @@ describe('ShootBlock', () => {
).toHaveAttribute('href', '/portfolio?shoot=portret');
});
it('loads a priority photo straight away and others lazily', async () => {
it('loads a priority photo straight away, its detail photo lazily', async () => {
await renderBlock('newborn', { priority: true });
expect(screen.getByRole('img')).not.toHaveAttribute('loading', 'lazy');
const [main, detail] = screen.getAllByRole('img');
expect(main).not.toHaveAttribute('loading', 'lazy');
expect(detail).toHaveAttribute('loading', 'lazy');
});
});
@@ -44,6 +44,8 @@ export default function ShootBlock({
<MediaText
image={shoot.image}
aspectRatio="4 / 5"
mediaSize="small"
detailImage={shoot.detailImage}
frameColor={shoot.frameColor}
reverse={reverse}
priority={priority}
@@ -1,4 +1,4 @@
import { screen } from '@testing-library/react';
import { screen, within } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import packages from '@/content/packages';
import shootTypes from '@/content/shootTypes';
@@ -36,11 +36,16 @@ describe('ShootList', () => {
expect(await axeResults(container)).toHaveNoViolations();
});
// The main photo of each shoot: the first image in its article
const mainPhotos = () =>
screen
.getAllByRole('article')
.map((article) => within(article).getAllByRole('img')[0]);
it('alternates the photo side: every second shoot has it on the right', async () => {
await renderList();
const reversed = screen.getAllByRole('img').map((img) =>
// img → FramedImage wrapper → photo column
cssRulesFor(img.parentElement!.parentElement!).some((rule) =>
const reversed = mainPhotos().map((img) =>
cssRulesFor(img.closest('[data-reveal]')!).some((rule) =>
/order: 2;/.test(rule),
),
);
@@ -49,22 +54,24 @@ describe('ShootList', () => {
it('only loads the first photo straight away', async () => {
await renderList();
expect(
screen
.getAllByRole('img')
.map((img) => img.getAttribute('loading')),
).toEqual([null, 'lazy', 'lazy', 'lazy', 'lazy']);
expect(mainPhotos().map((img) => img.getAttribute('loading'))).toEqual([
null,
'lazy',
'lazy',
'lazy',
'lazy',
]);
});
it('draws a line between the shoots, not above the first', async () => {
it('alternates the background of the bands', async () => {
await renderList();
const borders = screen
const tones = screen
.getAllByRole('article')
.map((article) =>
cssRulesFor(article.parentElement!).some((rule) =>
/border-top-width: 1px/.test(rule),
cssRulesFor(article.closest('section')!).some((rule) =>
/background: var\(--slp-colors-paper-alt\)/.test(rule),
),
);
expect(borders).toEqual([false, true, true, true, true]);
expect(tones).toEqual([false, true, false, true, false]);
});
});
@@ -9,24 +9,23 @@ type ShootListProps = {
portfolioLive: boolean;
};
// The shoot types below the page head, photo and text alternating sides,
// with a hairline between them (design .shoot + .shoot). The section needs
// no name of its own: every shoot is an article named by its heading.
// The shoot types below the page head, each in its own full-width band:
// the background alternates paper and paper.alt, and so does the side of
// the photo. The bands need no name of their own: every shoot is an
// article named by its heading.
export default function ShootList({
shoots,
packages,
portfolioLive,
}: ShootListProps) {
return (
<PageSection spacing="flushTop" data-testid="shoot-list">
<Box data-testid="shoot-list">
{shoots.map((shoot, index) => (
<Box
<PageSection
key={shoot.id}
py="clamp(2.5rem, 6vw, 5rem)"
borderTopWidth={index > 0 ? '1px' : undefined}
borderColor="line"
// The first block sits right below the page head
pt={index === 0 ? 0 : undefined}
tone={index % 2 === 1 ? 'alt' : 'paper'}
// The first band sits right below the page head
spacing={index === 0 ? 'flushTop' : 'default'}
>
<ShootBlock
shoot={shoot}
@@ -35,8 +34,8 @@ export default function ShootList({
priority={index === 0}
portfolioLive={portfolioLive}
/>
</Box>
</PageSection>
))}
</PageSection>
</Box>
);
}