1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 22:46:39 -04:00

re-add custom getLayout option removed in d50ae0f85a

This commit is contained in:
2022-05-01 11:15:25 -04:00
parent d718555001
commit d8d7d7d775
5 changed files with 140 additions and 113 deletions

View File

@ -28,9 +28,11 @@ const FlexedFooter = styled(Footer, {
flex: 1,
});
export type LayoutProps = ComponentProps<typeof Flex>;
export type LayoutProps = ComponentProps<typeof Flex> & {
container?: boolean; // pass false to disable default `<main>` container styles with padding, etc.
};
const Layout = ({ children, ...rest }: LayoutProps) => {
const Layout = ({ container = true, children, ...rest }: LayoutProps) => {
const { resolvedTheme } = useTheme();
return (
@ -43,9 +45,14 @@ const Layout = ({ children, ...rest }: LayoutProps) => {
<Flex {...rest}>
<Header />
<Default>
<Container>{children}</Container>
</Default>
{/* passing `container={false}` to Layout allows 100% control of the content area on a per-page basis */}
{container ? (
<Default>
<Container>{children}</Container>
</Default>
) : (
children
)}
<FlexedFooter />
</Flex>