Adds the Prijzen section to the homepage
Shows the three live packages as cards with their price and what is included. Each card links to the contact section with ?pakket=<id>, so the contact form can preselect it. Invalid packages from the CMS are skipped and the pakket value is only accepted when it names a package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import { Box, Grid } from '@chakra-ui/react';
|
||||
import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
||||
import HomeSection from '@/components/HomeSection/HomeSection';
|
||||
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 (
|
||||
<HomeSection labelledBy={TITLE_ID} 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>
|
||||
</HomeSection>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user