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>
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
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>
|
||
);
|
||
}
|