webapp/src/components/_shared/PageWrap.tsx

42 lines
987 B
TypeScript
Raw Normal View History

2022-09-22 09:37:49 +00:00
import type { JSX } from 'solid-js'
import { Header } from '../Nav/Header'
import { Footer } from '../Discours/Footer'
import '../../styles/app.scss'
2022-09-29 11:15:59 +00:00
import { Show } from 'solid-js'
2022-11-16 21:08:04 +00:00
import { clsx } from 'clsx'
2022-09-22 09:37:49 +00:00
type PageWrapProps = {
2022-09-22 09:37:49 +00:00
headerTitle?: string
articleBody?: string
cover?: string
2022-09-22 09:37:49 +00:00
children: JSX.Element
2022-09-23 21:29:32 +00:00
isHeaderFixed?: boolean
2022-09-29 11:15:59 +00:00
hideFooter?: boolean
2022-11-16 21:08:04 +00:00
class?: string
2022-09-22 09:37:49 +00:00
}
export const PageWrap = (props: PageWrapProps) => {
2022-11-21 13:02:04 +00:00
const isHeaderFixed = props.isHeaderFixed === undefined ? true : props.isHeaderFixed
2022-09-23 21:29:32 +00:00
2022-09-22 09:37:49 +00:00
return (
<>
<Header
title={props.headerTitle}
articleBody={props.articleBody}
cover={props.articleBody}
isHeaderFixed={isHeaderFixed}
/>
2022-11-16 21:08:04 +00:00
<main
class={clsx('main-content', props.class)}
classList={{ 'main-content--no-padding': !isHeaderFixed }}
>
2022-09-29 19:16:17 +00:00
{props.children}
</main>
2022-09-29 11:15:59 +00:00
<Show when={props.hideFooter !== true}>
<Footer />
</Show>
2022-09-22 09:37:49 +00:00
</>
)
}