UNPKG

604 BJavaScriptView Raw
1import React from 'react'
2import Navbar from './navbar'
3import Sidebar from './Sidebar'
4import {Flex, Box} from 'rebass'
5import { theme } from 'src/theme'
6import { ThemeProvider } from 'styled-components'
7
8const IS_STATIC = process.env.GATSBY_IS_STATIC
9
10const Layout = ({children, path}) => {
11 const showSidebar = IS_STATIC || path.match(/cli-commands|configuring-npm|using-npm/)
12
13 return (
14 <ThemeProvider theme={theme}>
15 <Navbar />
16 <Flex w={1}>
17 {showSidebar && <Sidebar />}
18 <Box width={1}>{children}</Box>
19 </Flex>
20 </ThemeProvider>
21 )
22}
23
24export default Layout