Extracts shared section blocks for use beyond the homepage

HomeSection becomes PageSection, since every page needs the same section
frame, and gains a flushTop spacing for a block right below a page head.
The framed photo next to text from the homepage About block becomes
MediaText, and the accent label that four components wrote out by hand
becomes Eyebrow, which can also render as a heading. The homepage renders
exactly as before: a layout comparison of every element against master
at three widths shows no differences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 23:35:22 +02:00
co-authored by Claude Opus 5.5
parent 26106f280f
commit 01e849c6b0
18 changed files with 321 additions and 89 deletions
@@ -0,0 +1,56 @@
import type { ReactNode } from 'react';
import { Box, Container } from '@chakra-ui/react';
type PageSectionProps = {
// Id of the heading that names this section for assistive technology
labelledBy: string;
id?: string;
tone?: 'paper' | 'alt';
// full: no content column, for edge-to-edge content; the section then
// places its own Container around what should stay in the column
width?: 'default' | 'narrow' | 'full';
// flushTop: no space above, for the first block right below a page head
// (design .section--flush-top)
spacing?: 'default' | 'tight' | 'flushTop';
'data-testid'?: string;
children: ReactNode;
};
// Frame of a content section on any page (design .section): vertical
// rhythm, an optional alternate background and the content column.
export default function PageSection({
labelledBy,
id,
tone = 'paper',
width = 'default',
spacing = 'default',
'data-testid': testId,
children,
}: PageSectionProps) {
const padding = spacing === 'tight' ? 'sectionYTight' : 'sectionY';
return (
<Box
as="section"
id={id}
aria-labelledby={labelledBy}
data-testid={testId}
bg={tone === 'alt' ? 'paper.alt' : 'paper'}
// An anchor target (#contact) lands right below the fixed header,
// which has shrunk to its sticky height by the time it gets there
scrollMarginTop={id ? 'header.sticky' : undefined}
pt={spacing === 'flushTop' ? 0 : padding}
pb={padding}
>
{width === 'full' ? (
children
) : (
<Container
maxW={width === 'narrow' ? 'contentNarrow' : 'content'}
>
{children}
</Container>
)}
</Box>
);
}