webapp/src/components/Layouts/MainLayout.tsx

30 lines
768 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-09-22 09:37:49 +00:00
2022-09-29 11:15:59 +00:00
type MainLayoutProps = {
2022-09-22 09:37:49 +00:00
headerTitle?: string
children: JSX.Element
2022-09-23 21:29:32 +00:00
isHeaderFixed?: boolean
2022-09-29 11:15:59 +00:00
hideFooter?: boolean
2022-09-22 09:37:49 +00:00
}
2022-09-29 11:15:59 +00:00
export const MainLayout = (props: MainLayoutProps) => {
2022-09-23 21:29:32 +00:00
const isHeaderFixed = props.isHeaderFixed !== undefined ? props.isHeaderFixed : true
2022-09-22 09:37:49 +00:00
return (
<>
2022-09-23 21:29:32 +00:00
<Header title={props.headerTitle} isHeaderFixed={isHeaderFixed} />
2022-09-29 19:16:17 +00:00
<main class="main-content" classList={{ 'main-content--no-padding': !isHeaderFixed }}>
{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
</>
)
}