2021-04-12 18:05:09 +00:00
|
|
|
import Header from './header'
|
2021-04-30 21:42:51 +00:00
|
|
|
import Head from 'next/head'
|
2021-04-14 23:56:29 +00:00
|
|
|
import Container from 'react-bootstrap/Container'
|
2021-04-22 22:14:32 +00:00
|
|
|
import { LightningProvider } from './lightning'
|
2021-04-30 21:42:51 +00:00
|
|
|
import { useRouter } from 'next/router'
|
2021-06-02 23:15:28 +00:00
|
|
|
import Footer from './footer'
|
2021-04-12 18:05:09 +00:00
|
|
|
|
2021-06-03 20:36:02 +00:00
|
|
|
export default function Layout ({ noContain, noFooter, children }) {
|
2021-04-30 21:42:51 +00:00
|
|
|
const router = useRouter()
|
|
|
|
const defaultTitle = router.asPath.split('?')[0].slice(1)
|
2021-04-12 18:05:09 +00:00
|
|
|
return (
|
|
|
|
<>
|
2021-04-22 22:14:32 +00:00
|
|
|
<LightningProvider>
|
2021-04-30 21:42:51 +00:00
|
|
|
<Head>
|
|
|
|
<title>{defaultTitle && `${defaultTitle} \\ `}stacker news</title>
|
|
|
|
<meta name='viewport' content='initial-scale=1.0, width=device-width' />
|
|
|
|
</Head>
|
2021-04-22 22:14:32 +00:00
|
|
|
<Header />
|
|
|
|
{noContain
|
|
|
|
? children
|
|
|
|
: (
|
2021-06-02 23:15:28 +00:00
|
|
|
<Container className='my-1 mb-4 px-sm-0'>
|
2021-04-22 22:14:32 +00:00
|
|
|
{children}
|
|
|
|
</Container>
|
|
|
|
)}
|
2021-06-03 20:36:02 +00:00
|
|
|
{!noFooter && <Footer />}
|
2021-04-22 22:14:32 +00:00
|
|
|
</LightningProvider>
|
2021-04-12 18:05:09 +00:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|