stacker.news/components/layout.js

63 lines
1.6 KiB
JavaScript
Raw Normal View History

import Header, { HeaderStatic } from './header'
2021-04-14 23:56:29 +00:00
import Container from 'react-bootstrap/Container'
2021-06-02 23:15:28 +00:00
import Footer from './footer'
import Seo, { SeoSearch } from './seo'
2022-01-26 21:43:18 +00:00
import Search from './search'
import styles from './layout.module.css'
2021-04-12 18:05:09 +00:00
2022-02-17 17:23:43 +00:00
export default function Layout ({
sub, contain = true, footer = true, footerLinks = true,
containClassName = '', seo = true, item, user, children
2022-02-17 17:23:43 +00:00
}) {
2021-04-12 18:05:09 +00:00
return (
<>
{seo && <Seo sub={sub} item={item} user={user} />}
<Header sub={sub} />
{contain
? (
<Container as='main' className={`px-sm-0 ${containClassName}`}>
{children}
</Container>
)
: children}
{footer && <Footer links={footerLinks} />}
2021-04-12 18:05:09 +00:00
</>
)
}
export function SearchLayout ({ sub, children, ...props }) {
return (
<Layout sub={sub} seo={false} contain={false} {...props}>
<SeoSearch sub={sub} />
<Search sub={sub} />
2023-10-26 18:01:01 +00:00
<Container as='main' className='pt-3 pb-4 px-sm-0'>
{children}
</Container>
</Layout>
)
}
export function StaticLayout ({ children, footer = true, footerLinks, ...props }) {
return (
<div className={styles.page}>
<HeaderStatic />
<main className={`${styles.content} pt-5`}>
{children}
</main>
{footer && <Footer links={footerLinks} />}
</div>
)
}
export function CenterLayout ({ children, ...props }) {
return (
<div className={styles.page}>
<Layout contain={false} {...props}>
<main className={styles.content}>
{children}
</main>
</Layout>
</div>
)
}