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:
@@ -0,0 +1,38 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Grid } from '@chakra-ui/react';
|
||||
import FramedImage from '@/components/FramedImage/FramedImage';
|
||||
import Reveal from '@/components/Reveal/Reveal';
|
||||
import type { ContentImage } from '@/content/types';
|
||||
|
||||
type MediaTextProps = {
|
||||
image: ContentImage;
|
||||
// CSS aspect ratio of the visible crop, e.g. '4 / 3'
|
||||
aspectRatio: string;
|
||||
'data-testid'?: string;
|
||||
// The text column; each page fills in its own heading and text
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
// A framed photo next to a text column (design .about), used on the
|
||||
// homepage and the about page. Stacked on phones and tablets, two equal
|
||||
// columns from `lg`; both columns fade in on scroll.
|
||||
export default function MediaText({
|
||||
image,
|
||||
aspectRatio,
|
||||
'data-testid': testId,
|
||||
children,
|
||||
}: MediaTextProps) {
|
||||
return (
|
||||
<Grid
|
||||
templateColumns={{ base: '1fr', lg: '1fr 1fr' }}
|
||||
gap="clamp(2rem, 6vw, 5.5rem)"
|
||||
alignItems="center"
|
||||
data-testid={testId}
|
||||
>
|
||||
<Reveal>
|
||||
<FramedImage image={image} aspectRatio={aspectRatio} />
|
||||
</Reveal>
|
||||
<Reveal>{children}</Reveal>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user