2020-12-27 11:18:33 -08:00
|
|
|
import React, { useEffect } from 'react';
|
2020-04-17 11:07:32 -07:00
|
|
|
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';
|
2020-04-17 11:07:32 -07:00
|
|
|
|
2020-08-22 19:05:43 -07:00
|
|
|
export interface PageContentBlockProps {
|
2026-10-12 19:14:14 -04:00
|
|
|
/** Titles the document. */
|
2020-08-22 15:43:28 -07:00
|
|
|
title?: string;
|
2026-10-12 19:14:14 -04:00
|
|
|
/** Classes for the block's outermost element, such as geometry tokens: `[--layout-gutter:0px]`. */
|
2020-08-22 15:43:28 -07:00
|
|
|
className?: string;
|
2026-10-05 18:10:18 -04:00
|
|
|
children?: React.ReactNode;
|
2020-08-22 15:43:28 -07:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
2020-08-22 15:43:28 -07: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-08-22 15:43:28 -07:00
|
|
|
);
|
|
|
|
|
};
|
2020-07-04 09:28:03 -07:00
|
|
|
|
|
|
|
|
export default PageContentBlock;
|