Files

34 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2020-12-27 11:18:33 -08:00
import React, { useEffect } from 'react';
import ContentContainer from '@/components/elements/ContentContainer';
2026-10-12 19:14:14 -04:00
import PageFooter from '@/components/elements/PageFooter';
import { setPageTitle } from '@/views/pageTitle';
export interface PageContentBlockProps {
2026-10-12 19:14:14 -04:00
/** Titles the document. */
title?: string;
2026-10-12 19:14:14 -04:00
/** Classes for the block's outermost element, such as geometry tokens: `[--layout-gutter:0px]`. */
className?: string;
2026-10-05 18:10:18 -04:00
children?: React.ReactNode;
}
2026-10-12 19:14:14 -04:00
/**
* A page's content and its footer. The content is `page-width` with `--layout-page-spacing` above and
* below; the geometry tokens cascade, so a page changes its own by setting them in `className`.
*/
2026-10-05 18:10:18 -04:00
const PageContentBlock = ({ title, className, children }: PageContentBlockProps) => {
2020-12-27 11:18:33 -08:00
useEffect(() => {
2026-10-12 19:14:14 -04:00
if (title) {
setPageTitle(title);
}
2026-10-12 17:58:43 -04:00
}, [title]);
2020-12-27 11:18:33 -08:00
return (
2026-10-12 19:14:14 -04:00
<div className={className}>
<ContentContainer className='my-(--layout-page-spacing)'>{children}</ContentContainer>
<PageFooter />
2026-10-05 18:10:18 -04:00
</div>
);
};
2020-07-04 09:28:03 -07:00
export default PageContentBlock;