Gives a featured package a quiet highlight and makes the optional CMS fields explicit

A featured card gets a heidegroen top rule, border and a small "Uitgelicht"
tab on its top edge; the tab sits on the border so the row keeps its layout.
Tests and docs state that the site does not depend on description, price note
or button label.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 14:15:23 +01:00
co-authored by Claude Sonnet 5.5
parent 9e8a876cd1
commit ba7288526b
4 changed files with 83 additions and 1 deletions
@@ -42,4 +42,40 @@ describe('PriceCard', () => {
expect(link).toHaveTextContent('Boek je shoot');
expect(link).toHaveAttribute('href', '/?pakket=bruiloft#contact');
});
it('marks a featured package with a tab and leaves others plain', async () => {
const { container } = await renderWithProviders(
<>
<PriceCard pkg={{ ...newborn, featured: true }} />
<PriceCard pkg={packages[0]} />
</>,
);
const featured = screen.getByTestId('price-card-newborn');
expect(featured).toHaveAttribute('data-featured', 'true');
expect(within(featured).getByText('Uitgelicht')).toBeInTheDocument();
const plain = screen.getByTestId(`price-card-${packages[0].id}`);
expect(plain).not.toHaveAttribute('data-featured');
expect(within(plain).queryByText('Uitgelicht')).not.toBeInTheDocument();
expect(await axeResults(container)).toHaveNoViolations();
});
it('does not depend on the description, price note or button label', async () => {
await renderWithProviders(
<PriceCard
pkg={{
...newborn,
description: 'Een beschrijving',
priceNote: 'Een notitie',
ctaLabel: 'Een knop',
}}
/>,
);
const card = screen.getByTestId('price-card-newborn');
expect(card).not.toHaveTextContent('Een beschrijving');
expect(card).not.toHaveTextContent('Een notitie');
expect(card).not.toHaveTextContent('Een knop');
expect(
within(card).getByRole('link', { name: 'Boek Newborn' }),
).toBeInTheDocument();
});
});
+29 -1
View File
@@ -17,6 +17,12 @@ type PriceCardProps = {
// One package (design .price-card): name, price, what is included and a
// link that takes the visitor to the contact form with this package chosen.
// A featured package (the star in the CMS) gets the quiet highlight of the
// banners: a heidegroen rule along the top, a heidegroen border and a small
// "Uitgelicht" tab on the top edge. The tab sits on the border instead of in
// the card, so the cards of a row keep the same layout. The package's
// description and price note from the CMS are not shown, so the card never
// depends on them.
export default function PriceCard({ pkg }: PriceCardProps) {
const label = bookLabel(pkg.name);
const linkButton = useRecipe({ key: 'linkButton' });
@@ -25,6 +31,8 @@ export default function PriceCard({ pkg }: PriceCardProps) {
<Box
as="article"
data-testid={`price-card-${pkg.id}`}
data-featured={pkg.featured ? 'true' : undefined}
position="relative"
display="flex"
flexDirection="column"
h="100%"
@@ -32,11 +40,31 @@ export default function PriceCard({ pkg }: PriceCardProps) {
py="clamp(2rem, 3.5vw, 3rem)"
bg="white"
borderWidth="1px"
borderColor="line"
borderColor={pkg.featured ? 'accent' : 'line'}
// The rule is an inset shadow, so it adds no width to the border
boxShadow={
pkg.featured ? 'inset 0 3px 0 {colors.accent}' : undefined
}
// No hover effect on the card itself (owner's choice); only the
// booking button reacts
textAlign="center"
>
{pkg.featured && (
<Text
textStyle="eyebrow"
position="absolute"
top="0"
left="50%"
transform="translate(-50%, -50%)"
px={3}
py={1}
bg="accent.deep"
color="white"
whiteSpace="nowrap"
>
Uitgelicht
</Text>
)}
{/* Smaller than the design's 1.75rem: stays clearly below the
30px section h2 (owner's request) */}
<Heading as="h3" fontSize="1.5rem" mb={3}>
+16
View File
@@ -125,6 +125,22 @@ describe('mapOfferings', () => {
});
});
describe('mapOfferings without description, price note and button label', () => {
const bare = { slug: 'x', title: 'X', price: '€ 100', features: ['a'] };
it.each([
['absent', {}],
['null', { description: null, priceNote: null, ctaLabel: null }],
['empty', { description: '', priceNote: ' ', ctaLabel: '' }],
])('still gives the card when they are %s', (_name, extra) => {
const mapped = mapOfferings([{ ...bare, ...extra }]);
expect(mapped?.packages).toHaveLength(1);
expect(mapped?.packages[0]).toMatchObject({ id: 'x', price: 100 });
expect(mapped?.packages[0].description).toBeUndefined();
expect(mapped?.packages[0].priceNote).toBeUndefined();
});
});
describe('mapBanner', () => {
it('neemt titel, tekst en een volledige link', () => {
expect(