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:
2026-10-20 01:07:36 +02:00
co-authored by Claude Opus 5.5
parent 0b54a67dc4
commit 30dab1af42
32 changed files with 1250 additions and 6 deletions
+49 -1
View File
@@ -1,5 +1,9 @@
import fc from 'fast-check';
import type { EmailAddress, SocialLink } from '../content/types';
import type {
EmailAddress,
PricingPackage,
SocialLink,
} from '../content/types';
// Gedeelde generators voor de property-based tests (fast-check)
@@ -47,3 +51,47 @@ export const anyEmail: fc.Arbitrary<EmailAddress> = fc.oneof(
validEmail,
fc.record({ user: fc.string(), domain: fc.string() }),
);
// Package ids: a few fixed ones so lists contain duplicates, plus random slugs
const packageId = fc.oneof(
fc.constantFrom('newborn', 'gezin', 'zwangerschap'),
fc.stringMatching(/^[a-z0-9-]{1,16}$/),
);
const nonBlank = fc
.string({ minLength: 1, maxLength: 30 })
.filter((text) => text.trim() !== '');
// A package that meets every invariant
export const pricingPackage: fc.Arbitrary<PricingPackage> = fc.record({
id: packageId,
name: nonBlank,
price: fc.integer({ min: 1, max: 5000 }),
features: fc.array(nonBlank, { minLength: 1, maxLength: 5 }),
});
// Valid packages with unique ids, as a well-behaved CMS would deliver them
export const uniquePackages = fc.uniqueArray(pricingPackage, {
selector: (pkg) => pkg.id,
maxLength: 6,
});
// Valid and broken packages mixed, as a CMS might deliver them
export const anyPackage: fc.Arbitrary<PricingPackage> = fc.oneof(
pricingPackage,
fc.record({
id: fc.oneof(
packageId,
fc.constantFrom('', 'Newborn', 'met spatie', 'a/b'),
fc.string(),
),
name: fc.oneof(nonBlank, fc.constantFrom('', ' ')),
price: fc.oneof(
fc.integer({ min: 1, max: 5000 }),
fc.constantFrom(0, -5, 12.5, Number.NaN, Infinity),
),
features: fc.oneof(
fc.array(nonBlank, { maxLength: 3 }),
fc.constant<string[]>(['', 'x']),
),
}),
);