forked from jamstack-cms/jamstack-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainLayout.js
41 lines (37 loc) · 806 Bytes
/
mainLayout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react"
import { css } from "@emotion/core"
import { BlogContext } from '../context/mainContext'
function MainLayout(props) {
const { children, noPadding, customCss = [] } = props
let basePadding = css`
padding-top: 35px;
padding-bottom: 25px;
`
if (noPadding) {
basePadding = css`
padding: 0;
`
}
return (
<div>
<main css={[mainContent, basePadding, ...customCss]}>{children}</main>
</div>
)
}
function MainLayoutWithContext(props) {
return (
<BlogContext.Consumer>
{
context => <MainLayout {...props} context={context} />
}
</BlogContext.Consumer>
)
}
export default MainLayoutWithContext
const mainContent = css`
margin: auto;
width: 944px;
@media (max-width: 1000px) {
width: 100%;
}
`