stacker.news/components/layout.js

67 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-03-27 00:49:10 +00:00
import Navigation from './nav'
import NavFooter from './nav/mobile/footer'
import NavStatic from './nav/static'
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} />}
2024-02-23 15:32:20 +00:00
<Navigation sub={sub} />
{contain
? (
2024-02-23 15:32:20 +00:00
<Container as='main' className={`px-sm-0 ${styles.contain}`}>
{children}
</Container>
)
: children}
{footer && <Footer links={footerLinks} />}
2024-02-23 15:32:20 +00:00
<NavFooter sub={sub} />
2021-04-12 18:05:09 +00:00
</>
)
}
export function SearchLayout ({ sub, children, ...props }) {
return (
2024-02-23 15:32:20 +00:00
<Layout sub={sub} seo={false} footer={false} {...props}>
<SeoSearch sub={sub} />
<Search sub={sub} />
2024-02-23 15:32:20 +00:00
{children}
</Layout>
)
}
2024-02-23 15:32:20 +00:00
export function StaticLayout ({ children, footer = true, footerLinks = false, ...props }) {
return (
2024-02-23 15:32:20 +00:00
<>
<NavStatic />
<div className={styles.page}>
<main className={`${styles.content} ${styles.contain} py-3`}>
{children}
</main>
</div>
{footer && <Footer links={footerLinks} />}
2024-02-23 15:32:20 +00:00
<NavFooter />
</>
)
}
export function CenterLayout ({ children, ...props }) {
return (
2024-02-23 15:32:20 +00:00
<Layout contain={false} footer={false} {...props}>
<div className={styles.page}>
<main className={styles.content}>
{children}
</main>
2024-02-23 15:32:20 +00:00
</div>
</Layout>
)
}