Adds the Lifestyle fotografie section to the homepage
Adds the first block below the hero: heading, intro and a staggered gallery of four live photos. Brings in the shared section building blocks (HomeSection, SectionHeading, Reveal) and DeferredImage, which holds back below-the-fold photos until the page has loaded so they do not compete with the hero for bandwidth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import SectionHeading from './SectionHeading';
|
||||
|
||||
describe('SectionHeading', () => {
|
||||
it('renders the label, an h2 with its id and the lead', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<SectionHeading
|
||||
id="prices-title"
|
||||
eyebrow="Pakketten"
|
||||
title="Prijzen"
|
||||
lead="Kies wat bij je past."
|
||||
/>,
|
||||
);
|
||||
const heading = screen.getByRole('heading', { level: 2 });
|
||||
expect(heading).toHaveTextContent('Prijzen');
|
||||
expect(heading).toHaveAttribute('id', 'prices-title');
|
||||
expect(screen.getByText('Pakketten')).toBeInTheDocument();
|
||||
expect(screen.getByText('Kies wat bij je past.')).toBeInTheDocument();
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('works with only a title', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<SectionHeading id="t" title="Instagram" align="start" />,
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('heading', { level: 2, name: 'Instagram' }),
|
||||
).toBeInTheDocument();
|
||||
expect(container.querySelectorAll('p')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Box, Heading, Text } from '@chakra-ui/react';
|
||||
|
||||
type SectionHeadingProps = {
|
||||
// Referenced by the section's aria-labelledby
|
||||
id: string;
|
||||
title: string;
|
||||
eyebrow?: string;
|
||||
lead?: string;
|
||||
align?: 'center' | 'start';
|
||||
};
|
||||
|
||||
// Heading block of a homepage section (design .section__head): optional
|
||||
// small label, the h2 and an optional intro sentence.
|
||||
export default function SectionHeading({
|
||||
id,
|
||||
title,
|
||||
eyebrow,
|
||||
lead,
|
||||
align = 'center',
|
||||
}: SectionHeadingProps) {
|
||||
const centered = align === 'center';
|
||||
|
||||
return (
|
||||
<Box
|
||||
maxW="620px"
|
||||
mx={centered ? 'auto' : undefined}
|
||||
mb="sectionHeadGap"
|
||||
textAlign={centered ? 'center' : 'start'}
|
||||
>
|
||||
{eyebrow && (
|
||||
// accent.deep instead of the design's accent: meets 4.5:1 (NFR-HP-01)
|
||||
<Text textStyle="eyebrow" color="accent.deep" mb={4}>
|
||||
{eyebrow}
|
||||
</Text>
|
||||
)}
|
||||
<Heading as="h2" id={id} textStyle="sectionTitle">
|
||||
{title}
|
||||
</Heading>
|
||||
{lead && (
|
||||
<Text textStyle="lead" color="ink.soft" mt={2}>
|
||||
{lead}
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user