www/components/layout.tsx

32 lines
847 B
TypeScript
Raw Normal View History

2021-12-08 03:38:31 +00:00
import Meta from './meta';
import Title from './title';
2022-04-28 01:55:18 +00:00
type ChildrenType = JSX.Element | Array<ChildrenType>;
type LayoutProps = {
2021-12-08 03:38:31 +00:00
name: string,
title?: string,
ancestors?: Array<{ name: string, path: string }>
2022-04-28 01:55:18 +00:00
children?: ChildrenType,
2022-10-05 03:41:59 +00:00
removeContainer?: boolean,
2021-12-08 03:38:31 +00:00
};
2022-10-05 03:41:59 +00:00
function Container(props: {children?: ChildrenType, ignore?: boolean}) {
if (props.ignore)
return <>{props.children}</>;
return <div className='container'>
{props.children}
</div>;
}
function Layout(props : LayoutProps) {
2021-12-08 03:38:31 +00:00
return (
<>
2022-10-05 03:41:59 +00:00
<Meta name={props.name} ancestors={props.ancestors} />
<Title title={props.title} name={props.name} ancestors={props.ancestors} />
<Container ignore={props.removeContainer}>{props.children}</Container>
2021-12-08 03:38:31 +00:00
</>
);
}
export default Layout;