Redesigns the testimonials section
A landscape photo overlaps a card with the shoot type, quote and names. The controls are two arrows with an X / Y counter; the dots are gone and nothing moves by itself. A change slides the whole slide horizontally, also on a swipe. Reviews get an optional imagePosition for the crop, normalised by normalizeImagePosition; slideCounter writes the counter. Both helpers have property tests next to example tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -68,13 +68,15 @@ export default function Testimonials({
|
||||
}
|
||||
|
||||
// Stands in for the carousel until it has loaded: the longest review laid
|
||||
// out exactly like a slide (same padding), plus the controls' height. That
|
||||
// makes it as tall as the carousel at every screen width, so nothing below
|
||||
// moves when the carousel takes its place, not even during a scroll to
|
||||
// #contact that passes this section while it loads. The other reviews are in
|
||||
// the page too, visually hidden, so the prerendered HTML holds every review
|
||||
// text for search engines (BR-LZY-02). They are aria-hidden and inert, so
|
||||
// assistive technology reads each review once, in the carousel.
|
||||
// out exactly like a slide, plus the room for the controls. From `lg` that
|
||||
// room is part of the slide; below `lg` the control bar follows the slides, so
|
||||
// a spacer of its height is added. That makes it as tall as the carousel at
|
||||
// every screen width, so nothing below moves when the carousel takes its
|
||||
// place, not even during a scroll to #contact that passes this section while
|
||||
// it loads. The other reviews are in the page too, visually hidden, so the
|
||||
// prerendered HTML holds every review text for search engines (BR-LZY-02).
|
||||
// They are aria-hidden and inert, so assistive technology reads each review
|
||||
// once, in the carousel.
|
||||
function CarouselPlaceholder({
|
||||
testimonials,
|
||||
}: {
|
||||
@@ -84,10 +86,8 @@ function CarouselPlaceholder({
|
||||
b.quote.length > a.quote.length ? b : a,
|
||||
);
|
||||
return (
|
||||
<Box>
|
||||
<Box ps={{ base: 0, sm: '1.5rem' }} pb={{ base: 0, sm: '1.5rem' }}>
|
||||
<TestimonialSlide testimonial={longest} />
|
||||
</Box>
|
||||
<Box maxW={{ lg: '1120px' }} mx="auto">
|
||||
<TestimonialSlide testimonial={longest} withControls />
|
||||
{testimonials
|
||||
.filter((testimonial) => testimonial !== longest)
|
||||
.map((testimonial) => (
|
||||
@@ -97,8 +97,13 @@ function CarouselPlaceholder({
|
||||
</Box>
|
||||
</VisuallyHidden>
|
||||
))}
|
||||
{/* The control bar: 48px buttons below the same margin */}
|
||||
<Box mt="clamp(2.5rem, 5vw, 4rem)" h="48px" data-requires-js />
|
||||
{/* Below lg the control bar: 44px buttons under a 28px margin */}
|
||||
<Box
|
||||
display={{ base: 'block', lg: 'none' }}
|
||||
mt={7}
|
||||
h="44px"
|
||||
data-requires-js
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user