Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit e8d1c04

Browse files
authored
feat(gatsby-theme-docz): create MainContainer component (#1381)
* feat: create a shadow-able MainContainer component
1 parent 65ebd37 commit e8d1c04

4 files changed

Lines changed: 30 additions & 18 deletions

File tree

core/gatsby-theme-docz/src/components/Layout/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/** @jsx jsx */
22
import { useRef, useState } from 'react'
3-
import { jsx, Layout as BaseLayout, Main, Container } from 'theme-ui'
3+
import { jsx, Layout as BaseLayout, Main } from 'theme-ui'
44
import { Global } from '@emotion/core'
55

66
import global from '~theme/global'
77
import { Header } from '../Header'
88
import { Sidebar } from '../Sidebar'
9+
import { MainContainer } from '../MainContainer'
910
import * as styles from './styles'
1011

1112
export const Layout = ({ children }) => {
@@ -25,9 +26,7 @@ export const Layout = ({ children }) => {
2526
onBlur={() => setOpen(false)}
2627
onClick={() => setOpen(false)}
2728
/>
28-
<Container sx={styles.content} data-testid="main-container">
29-
{children}
30-
</Container>
29+
<MainContainer data-testid="main-container">{children}</MainContainer>
3130
</div>
3231
</Main>
3332
</BaseLayout>

core/gatsby-theme-docz/src/components/Layout/styles.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,3 @@ export const wrapper = {
1616
display: 'block',
1717
},
1818
}
19-
20-
export const content = {
21-
backgroundColor: 'background',
22-
position: 'relative',
23-
maxWidth: 960,
24-
py: 5,
25-
px: 4,
26-
variant: 'styles.Container',
27-
[media.tablet]: {
28-
py: 4,
29-
px: 4,
30-
pt: 5,
31-
},
32-
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** @jsx jsx */
2+
import { jsx, Container } from 'theme-ui'
3+
4+
import * as styles from './styles'
5+
6+
export const MainContainer = ({ children, ...rest }) => {
7+
return (
8+
<Container sx={styles.container} {...rest}>
9+
{children}
10+
</Container>
11+
)
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { media } from '~theme/breakpoints'
2+
3+
export const container = {
4+
backgroundColor: 'background',
5+
position: 'relative',
6+
maxWidth: 960,
7+
py: 5,
8+
px: 4,
9+
variant: 'styles.Container',
10+
[media.tablet]: {
11+
py: 4,
12+
px: 4,
13+
pt: 5,
14+
},
15+
}

0 commit comments

Comments
 (0)