Skip to content

Commit

Permalink
feat(gatsby-theme-docz): create MainContainer component (#1381)
Browse files Browse the repository at this point in the history
* feat: create a shadow-able  MainContainer component
  • Loading branch information
mickaelzhang authored Feb 7, 2020
1 parent 65ebd37 commit e8d1c04
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
7 changes: 3 additions & 4 deletions core/gatsby-theme-docz/src/components/Layout/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/** @jsx jsx */
import { useRef, useState } from 'react'
import { jsx, Layout as BaseLayout, Main, Container } from 'theme-ui'
import { jsx, Layout as BaseLayout, Main } from 'theme-ui'
import { Global } from '@emotion/core'

import global from '~theme/global'
import { Header } from '../Header'
import { Sidebar } from '../Sidebar'
import { MainContainer } from '../MainContainer'
import * as styles from './styles'

export const Layout = ({ children }) => {
Expand All @@ -25,9 +26,7 @@ export const Layout = ({ children }) => {
onBlur={() => setOpen(false)}
onClick={() => setOpen(false)}
/>
<Container sx={styles.content} data-testid="main-container">
{children}
</Container>
<MainContainer data-testid="main-container">{children}</MainContainer>
</div>
</Main>
</BaseLayout>
Expand Down
14 changes: 0 additions & 14 deletions core/gatsby-theme-docz/src/components/Layout/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,3 @@ export const wrapper = {
display: 'block',
},
}

export const content = {
backgroundColor: 'background',
position: 'relative',
maxWidth: 960,
py: 5,
px: 4,
variant: 'styles.Container',
[media.tablet]: {
py: 4,
px: 4,
pt: 5,
},
}
12 changes: 12 additions & 0 deletions core/gatsby-theme-docz/src/components/MainContainer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @jsx jsx */
import { jsx, Container } from 'theme-ui'

import * as styles from './styles'

export const MainContainer = ({ children, ...rest }) => {
return (
<Container sx={styles.container} {...rest}>
{children}
</Container>
)
}
15 changes: 15 additions & 0 deletions core/gatsby-theme-docz/src/components/MainContainer/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { media } from '~theme/breakpoints'

export const container = {
backgroundColor: 'background',
position: 'relative',
maxWidth: 960,
py: 5,
px: 4,
variant: 'styles.Container',
[media.tablet]: {
py: 4,
px: 4,
pt: 5,
},
}

0 comments on commit e8d1c04

Please sign in to comment.