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>
79 lines
2.9 KiB
TypeScript
79 lines
2.9 KiB
TypeScript
import { Box, Grid } from '@chakra-ui/react';
|
|
import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
|
import PageSection from '@/components/PageSection/PageSection';
|
|
import Reveal from '@/components/Reveal/Reveal';
|
|
import SectionHeading from '@/components/SectionHeading/SectionHeading';
|
|
import type { HomeContent, PricingPackage } from '@/content/types';
|
|
import { visiblePackages } from '@/lib/visiblePackages';
|
|
import PriceCard from './PriceCard';
|
|
|
|
const TITLE_ID = 'pricing-title';
|
|
const STAGGER = 0.08;
|
|
|
|
// Where the two decorations sit (design .pricing__deco--1 and --2). The
|
|
// design measures from the whole section; here they sit in the content box,
|
|
// so the second one moves down into the section's bottom padding, or the
|
|
// last card would cover it.
|
|
const decorationPositions = [
|
|
{ top: '8%', left: '2%' },
|
|
{ bottom: 'calc(-0.6 * {spacing.sectionY})', right: '2%' },
|
|
];
|
|
|
|
type PricingProps = {
|
|
content: HomeContent['pricing'];
|
|
packages: PricingPackage[];
|
|
};
|
|
|
|
// "Prijzen": the shoot packages as cards (design .pricing). One column on
|
|
// phones and tablets, three from `lg`. Without a valid package the section
|
|
// is left out entirely.
|
|
export default function Pricing({ content, packages }: PricingProps) {
|
|
const shown = visiblePackages(packages);
|
|
if (shown.length === 0) return null;
|
|
|
|
return (
|
|
<PageSection
|
|
labelledBy={TITLE_ID}
|
|
// Anchor for links such as "de pakketten" (/#prijzen)
|
|
id="prijzen"
|
|
data-testid="pricing"
|
|
>
|
|
<Box position="relative" isolation="isolate">
|
|
{content.decorations.map((decoration, index) => (
|
|
<DeferredImage
|
|
key={decoration.src}
|
|
image={decoration}
|
|
aria-hidden="true"
|
|
position="absolute"
|
|
zIndex={-1}
|
|
w="clamp(90px, 10vw, 160px)"
|
|
h="auto"
|
|
opacity={0.55}
|
|
pointerEvents="none"
|
|
{...decorationPositions[index % 2]}
|
|
/>
|
|
))}
|
|
<Reveal>
|
|
<SectionHeading
|
|
id={TITLE_ID}
|
|
title={content.title}
|
|
lead={content.lead}
|
|
/>
|
|
</Reveal>
|
|
<Grid
|
|
templateColumns={{ base: '1fr', lg: 'repeat(3, 1fr)' }}
|
|
gap="gridGap"
|
|
maxW={{ base: '460px', lg: 'none' }}
|
|
mx="auto"
|
|
>
|
|
{shown.map((pkg, index) => (
|
|
<Reveal key={pkg.id} delay={index * STAGGER} h="100%">
|
|
<PriceCard pkg={pkg} />
|
|
</Reveal>
|
|
))}
|
|
</Grid>
|
|
</Box>
|
|
</PageSection>
|
|
);
|
|
}
|