Adds the Lieve woorden section to the homepage
Shows client reviews one at a time with the framed photo, a large quotation mark, the shoot type and the names. Uses Chakra's carousel for paging, looping and swiping with our own controls, so visitors who prefer reduced motion get instant changes, and loads the carousel only when the section comes near the screen so the hero does not wait for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
EmailAddress,
|
||||
PricingPackage,
|
||||
SocialLink,
|
||||
Testimonial,
|
||||
} from '../content/types';
|
||||
|
||||
// Gedeelde generators voor de property-based tests (fast-check)
|
||||
@@ -95,3 +96,45 @@ export const anyPackage: fc.Arbitrary<PricingPackage> = fc.oneof(
|
||||
),
|
||||
}),
|
||||
);
|
||||
|
||||
const image = fc.record({
|
||||
src: fc.webPath().map((path) => `/assets${path}.jpg`),
|
||||
alt: fc.string({ maxLength: 40 }),
|
||||
width: fc.integer({ min: 1, max: 4000 }),
|
||||
height: fc.integer({ min: 1, max: 4000 }),
|
||||
});
|
||||
|
||||
// A review that meets every invariant
|
||||
export const testimonial: fc.Arbitrary<Testimonial> = fc.record({
|
||||
id: fc.oneof(
|
||||
fc.constantFrom('majella-mark', 'demi-kevin'),
|
||||
fc.stringMatching(/^[a-z0-9-]{1,16}$/),
|
||||
),
|
||||
shoot: nonBlank,
|
||||
quote: nonBlank,
|
||||
author: nonBlank,
|
||||
image,
|
||||
});
|
||||
|
||||
// Valid reviews with unique ids
|
||||
export const uniqueTestimonials = fc.uniqueArray(testimonial, {
|
||||
selector: (item) => item.id,
|
||||
maxLength: 6,
|
||||
});
|
||||
|
||||
// Valid and broken reviews mixed, as a CMS might deliver them
|
||||
export const anyTestimonial: fc.Arbitrary<Testimonial> = fc.oneof(
|
||||
testimonial,
|
||||
fc.record({
|
||||
id: fc.oneof(fc.constantFrom('majella-mark', '', ' '), fc.string()),
|
||||
shoot: fc.oneof(nonBlank, fc.constantFrom('', ' ')),
|
||||
quote: fc.oneof(nonBlank, fc.constantFrom('', ' ')),
|
||||
author: fc.oneof(nonBlank, fc.constantFrom('', ' ')),
|
||||
image: fc.record({
|
||||
src: fc.oneof(fc.constant(''), fc.constant('/a.jpg')),
|
||||
alt: fc.string({ maxLength: 10 }),
|
||||
width: fc.integer({ min: -1, max: 10 }),
|
||||
height: fc.integer({ min: -1, max: 10 }),
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -32,3 +32,13 @@ Object.defineProperty(window, 'matchMedia', {
|
||||
}),
|
||||
});
|
||||
window.scrollTo = () => {};
|
||||
|
||||
// jsdom has no ResizeObserver either; the carousel (Zag) needs one. Nothing
|
||||
// is measured in jsdom, so a no-op is enough. IntersectionObserver is left
|
||||
// out on purpose: useInView and DeferredImage are tested without it, and
|
||||
// tests that render the carousel stub it themselves.
|
||||
globalThis.ResizeObserver ??= class {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user