Adds the Over mij page
Replaces the placeholder with the page from the design and the texts from the live site: Andrea's introduction with her portrait, how it started, two photos, life outside photography and a booking button. The page is now indexed, with its own title, description, preview image and AboutPage data about Andrea. The portrait loads straight away instead of after the page, since on phones it is the largest paint. Lighthouse no longer lets every indexed page use the homepage's lower mobile performance target; it now only applies to the homepage itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import aboutContent from '@/content/aboutContent';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import AboutIntro from './AboutIntro';
|
||||
|
||||
const intro = aboutContent.intro;
|
||||
|
||||
describe('AboutIntro', () => {
|
||||
it('shows the label, heading, text, portrait and links', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<AboutIntro content={intro} />,
|
||||
);
|
||||
const section = screen.getByRole('region', { name: intro.title });
|
||||
expect(
|
||||
within(section).getByRole('heading', { level: 2 }),
|
||||
).toHaveTextContent(intro.title);
|
||||
expect(within(section).getByText(intro.eyebrow)).toBeInTheDocument();
|
||||
expect(within(section).getByRole('img')).toHaveAccessibleName(
|
||||
intro.image.alt,
|
||||
);
|
||||
expect(section).toHaveTextContent(
|
||||
'Bekijk mijn portfolio of neem contact op voor een fotoshoot!',
|
||||
);
|
||||
expect(
|
||||
within(section).getByRole('link', { name: 'mijn portfolio' }),
|
||||
).toHaveAttribute('href', '/portfolio');
|
||||
expect(
|
||||
within(section).getByRole('link', { name: 'neem contact op' }),
|
||||
).toHaveAttribute('href', '/#contact');
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Stack } from '@chakra-ui/react';
|
||||
import RichParagraph from '@/components/about/RichParagraph/RichParagraph';
|
||||
import MediaText from '@/components/MediaText/MediaText';
|
||||
import PageSection from '@/components/PageSection/PageSection';
|
||||
import SectionHeading from '@/components/SectionHeading/SectionHeading';
|
||||
import type { AboutPageContent } from '@/content/types';
|
||||
|
||||
const TITLE_ID = 'about-intro-title';
|
||||
|
||||
type AboutIntroProps = {
|
||||
content: AboutPageContent['intro'];
|
||||
};
|
||||
|
||||
// "Hoi! Ik ben Andrea": the framed portrait next to the introduction, right
|
||||
// below the page head (design .about in a .section--flush-top)
|
||||
export default function AboutIntro({ content }: AboutIntroProps) {
|
||||
return (
|
||||
<PageSection
|
||||
labelledBy={TITLE_ID}
|
||||
spacing="flushTop"
|
||||
data-testid="about-intro"
|
||||
>
|
||||
{/* Right below the page head: on phones the portrait is the
|
||||
largest paint, so it must not wait for the page to load */}
|
||||
<MediaText image={content.image} aspectRatio="4 / 3" priority>
|
||||
<SectionHeading
|
||||
id={TITLE_ID}
|
||||
eyebrow={content.eyebrow}
|
||||
title={content.title}
|
||||
align="start"
|
||||
spacing="compact"
|
||||
/>
|
||||
<Stack gap={4} color="ink.soft">
|
||||
{content.paragraphs.map((paragraph, index) => (
|
||||
<RichParagraph key={index} paragraph={paragraph} />
|
||||
))}
|
||||
</Stack>
|
||||
</MediaText>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import RichParagraph from './RichParagraph';
|
||||
|
||||
describe('RichParagraph', () => {
|
||||
it('renders text and links in reading order', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
<RichParagraph
|
||||
paragraph={[
|
||||
'Bekijk ',
|
||||
{ text: 'mijn portfolio', to: '/portfolio' },
|
||||
' of ',
|
||||
{ text: 'neem contact op', to: '/', hash: 'contact' },
|
||||
'!',
|
||||
]}
|
||||
/>,
|
||||
);
|
||||
expect(container).toHaveTextContent(
|
||||
'Bekijk mijn portfolio of neem contact op!',
|
||||
);
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'mijn portfolio' }),
|
||||
).toHaveAttribute('href', '/portfolio');
|
||||
expect(
|
||||
screen.getByRole('link', { name: 'neem contact op' }),
|
||||
).toHaveAttribute('href', '/#contact');
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('renders a paragraph without links as plain text', async () => {
|
||||
await renderWithProviders(<RichParagraph paragraph={['Hoi!']} />);
|
||||
expect(screen.getByText('Hoi!')).toBeInTheDocument();
|
||||
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Link, Text } from '@chakra-ui/react';
|
||||
import RouterLink from '@/components/RouterLink';
|
||||
import type { RichText } from '@/content/types';
|
||||
|
||||
type RichParagraphProps = {
|
||||
paragraph: RichText;
|
||||
};
|
||||
|
||||
// One paragraph of running text with links in it (BR-OM-03): text pieces as
|
||||
// they are, link pieces as underlined router links.
|
||||
export default function RichParagraph({ paragraph }: RichParagraphProps) {
|
||||
return (
|
||||
<Text>
|
||||
{paragraph.map((piece, index) =>
|
||||
typeof piece === 'string' ? (
|
||||
piece
|
||||
) : (
|
||||
// Static content: the order never changes, so the index
|
||||
// is a stable key
|
||||
<Link key={index} variant="underline" asChild>
|
||||
<RouterLink to={piece.to} hash={piece.hash}>
|
||||
{piece.text}
|
||||
</RouterLink>
|
||||
</Link>
|
||||
),
|
||||
)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { screen, within } from '@testing-library/react';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import aboutContent from '@/content/aboutContent';
|
||||
import { axeResults } from '@/test/axe';
|
||||
import { renderWithProviders } from '@/test/renderWithProviders';
|
||||
import StorySection from './StorySection';
|
||||
|
||||
const personal = aboutContent.personal;
|
||||
|
||||
describe('StorySection', () => {
|
||||
it('is a region named by its h3 label, with the text', async () => {
|
||||
const { container } = await renderWithProviders(
|
||||
// An h2 above it, as on the page, so the outline is complete
|
||||
<>
|
||||
<h2>Hoi! Ik ben Andrea</h2>
|
||||
<StorySection
|
||||
content={personal}
|
||||
titleId="personal-title"
|
||||
tone="alt"
|
||||
/>
|
||||
</>,
|
||||
);
|
||||
const section = screen.getByRole('region', { name: personal.title });
|
||||
expect(
|
||||
within(section).getByRole('heading', { level: 3 }),
|
||||
).toHaveAttribute('id', 'personal-title');
|
||||
personal.paragraphs.forEach((paragraph) =>
|
||||
expect(within(section).getByText(paragraph)).toBeInTheDocument(),
|
||||
);
|
||||
expect(await axeResults(container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('shows extra content below the text', async () => {
|
||||
await renderWithProviders(
|
||||
<StorySection content={personal} titleId="personal-title">
|
||||
<a href="/#contact">Boek je shoot</a>
|
||||
</StorySection>,
|
||||
);
|
||||
const section = screen.getByRole('region', { name: personal.title });
|
||||
expect(
|
||||
within(section).getByRole('link', { name: 'Boek je shoot' }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Box, Stack, Text } from '@chakra-ui/react';
|
||||
import Eyebrow from '@/components/Eyebrow/Eyebrow';
|
||||
import PageSection from '@/components/PageSection/PageSection';
|
||||
import Reveal from '@/components/Reveal/Reveal';
|
||||
import type { AboutPageContent } from '@/content/types';
|
||||
|
||||
type StorySectionProps = {
|
||||
content: AboutPageContent['background'];
|
||||
// Id of the h3, which names the section
|
||||
titleId: string;
|
||||
tone?: 'paper' | 'alt';
|
||||
spacing?: 'default' | 'flushTop';
|
||||
'data-testid'?: string;
|
||||
// Shown below the text, e.g. the booking button
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
// One part of Andrea's story in the narrow column. Its heading is an h3 in
|
||||
// the small label style: the story continues "Hoi! Ik ben Andrea" (FR-OM-03).
|
||||
export default function StorySection({
|
||||
content,
|
||||
titleId,
|
||||
tone,
|
||||
spacing,
|
||||
'data-testid': testId,
|
||||
children,
|
||||
}: StorySectionProps) {
|
||||
return (
|
||||
<PageSection
|
||||
labelledBy={titleId}
|
||||
width="narrow"
|
||||
tone={tone}
|
||||
spacing={spacing}
|
||||
data-testid={testId}
|
||||
>
|
||||
<Reveal>
|
||||
<Eyebrow as="h3" id={titleId}>
|
||||
{content.title}
|
||||
</Eyebrow>
|
||||
<Stack gap={4} color="ink.soft">
|
||||
{content.paragraphs.map((paragraph) => (
|
||||
<Text key={paragraph}>{paragraph}</Text>
|
||||
))}
|
||||
</Stack>
|
||||
{/* design .mt-lg */}
|
||||
{children && (
|
||||
<Box mt="clamp(2rem, 4vw, 2.5rem)">{children}</Box>
|
||||
)}
|
||||
</Reveal>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user