stacker.news/components/layout.js

51 lines
1.4 KiB
JavaScript
Raw Normal View History

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'
import { NextSeo } from 'next-seo'
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)
const fullTitle = `${defaultTitle && `${defaultTitle} \\ `}stacker news`
const desc = 'Discuss Bitcoin. Stack sats. News for plebs.'
2021-04-12 18:05:09 +00:00
return (
<>
<NextSeo
title={fullTitle}
description={desc}
openGraph={{
title: fullTitle,
description: desc,
images: [
{
2021-06-22 17:47:49 +00:00
url: 'https://stacker.news/favicon.png'
}
],
2021-06-22 17:47:49 +00:00
site_name: 'Stacker News'
}}
twitter={{
site: '@stacker_news',
2021-06-22 17:47:49 +00:00
cardType: 'summary_large_image'
}}
/>
2021-04-22 22:14:32 +00:00
<LightningProvider>
2021-04-30 21:42:51 +00:00
<Head>
<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-22 17:47:49 +00:00
<Container className='mt-1 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
</>
)
}