Adds the Contact page

The contact page in the approved layout: the form next to a photo with
the contact card on wide screens, and the card with a small portrait
above the form on phones, where the large photo is never downloaded.
/contact?pakket= preselects a package. The page is indexed, with its
own title, description, preview image and ContactPage structured data.
Over mij and Soorten fotoshoots now link to /contact. The green button
gets a darker background, so its white text meets the contrast minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 19:27:18 +01:00
co-authored by Claude Opus 5.5
parent ad85e3fe5b
commit e92b652061
25 changed files with 485 additions and 53 deletions
@@ -6,7 +6,7 @@ import {
Link,
VisuallyHidden,
} from '@chakra-ui/react';
import mailOutlined from '@iconify-icons/ant-design/mail-outlined';
import mailFilled from '@iconify-icons/ant-design/mail-filled';
import { Icon } from '@iconify/react/offline';
import Eyebrow from '@/components/Eyebrow/Eyebrow';
import socialPlatforms from '@/content/socialPlatforms';
@@ -27,7 +27,7 @@ type ContactDetailsProps = {
const iconOf = (channel: ContactChannel) =>
channel.kind === 'email'
? mailOutlined
? mailFilled
: socialPlatforms[channel.platform].icon;
// "Direct contact": a card with the ways to reach Andrea, each an icon and a
@@ -28,7 +28,7 @@ describe('AboutIntro', () => {
).toHaveAttribute('href', '/portfolio');
expect(
within(section).getByRole('link', { name: 'neem contact op' }),
).toHaveAttribute('href', '/#contact');
).toHaveAttribute('href', '/contact');
expect(await axeResults(container)).toHaveNoViolations();
});
});
@@ -0,0 +1,48 @@
import { screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { axeResults } from '@/test/axe';
import { renderWithProviders } from '@/test/renderWithProviders';
import ContactAside, { ASIDE_MEDIA } from './ContactAside';
const image = {
src: '/contact.jpg',
alt: 'Andrea met haar camera',
width: 840,
height: 1050,
};
describe('ContactAside', () => {
it('offers the photo only to wide screens, with priority', async () => {
const { container } = await renderWithProviders(
<ContactAside image={image}>
<p>Kaart</p>
</ContactAside>,
);
const source = container.querySelector('picture source');
expect(source).toHaveAttribute('media', ASIDE_MEDIA);
expect(source).toHaveAttribute('srcset', '/contact.jpg');
// Hidden in jsdom: it has no screen width, so the base display wins
const photo = screen.getByRole('img', {
name: image.alt,
hidden: true,
});
// Phones get a tiny inline image, never the photo itself
expect(photo.getAttribute('src')).toMatch(/^data:image\/gif/);
expect(photo).toHaveAttribute('fetchpriority', 'high');
expect(photo).toHaveAttribute('width', '840');
expect(photo).toHaveAttribute('height', '1050');
expect(await axeResults(container)).toHaveNoViolations();
});
it('lays the card over the photo', async () => {
await renderWithProviders(
<ContactAside image={image}>
<p>Kaart</p>
</ContactAside>,
);
expect(screen.getByTestId('contact-aside')).toContainElement(
screen.getByText('Kaart'),
);
});
});
@@ -0,0 +1,56 @@
import type { ReactNode } from 'react';
import { Box, chakra, Image } from '@chakra-ui/react';
import type { ContentImage } from '@/content/types';
// The media query from where the aside shows (theme breakpoint lg)
export const ASIDE_MEDIA = '(min-width: 64em)';
// A transparent 1×1 GIF: what phones get instead of the photo
const NO_PHOTO =
'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
type ContactAsideProps = {
image: ContentImage;
// The contact card, laid over the bottom of the photo
children: ReactNode;
};
// The right column of the contact page on wide screens: the photo with the
// contact card overlapping its bottom edge (mockup 1a, BR-CP-06..09).
// Hidden below lg; there the picture's source does not apply, so phones
// never download the photo. On wide screens it is the largest paint, so it
// loads straight away with high priority.
export default function ContactAside({ image, children }: ContactAsideProps) {
return (
<Box
display={{ base: 'none', lg: 'block' }}
position="relative"
// Room below the photo for the part of the card that sticks out
pb="7rem"
data-testid="contact-aside"
>
<chakra.picture display="block">
<source media={ASIDE_MEDIA} srcSet={image.src} />
<Image
src={NO_PHOTO}
alt={image.alt}
htmlWidth={image.width}
htmlHeight={image.height}
fetchPriority="high"
decoding="async"
display="block"
w="100%"
h="auto"
aspectRatio="4 / 5"
objectFit="cover"
// Shown until the photo arrives
bg="paper.deep"
data-testid="contact-aside-photo"
/>
</chakra.picture>
<Box position="absolute" left={6} right={6} bottom={0}>
{children}
</Box>
</Box>
);
}
@@ -49,7 +49,7 @@ describe('ShootBlock', () => {
const link = screen.getByRole('link', {
name: 'Stuur een berichtje over een zwangerschapsshoot',
});
expect(link).toHaveAttribute('href', '/?pakket=zwangerschap#contact');
expect(link).toHaveAttribute('href', '/contact?pakket=zwangerschap');
});
it('links to the contact form without a package when the shoot has none', async () => {
@@ -58,7 +58,7 @@ describe('ShootBlock', () => {
screen.getByRole('link', {
name: 'Stuur een berichtje over een loveshoot',
}),
).toHaveAttribute('href', '/#contact');
).toHaveAttribute('href', '/contact');
});
it('only links to the portfolio once it is live', async () => {