forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayout.js
More file actions
39 lines (35 loc) · 796 Bytes
/
Layout.js
File metadata and controls
39 lines (35 loc) · 796 Bytes
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
import React from 'react'
import PropTypes from 'prop-types'
import { Box } from '@chakra-ui/core'
export const Layout = ({ fluid, columns, ...props }) => {
const col = {
base: columns.base * 100 + '%',
md: columns.md * 100 + '%',
lg: columns.lg * 100 + '%',
xl: columns.xl * 100 + '%',
}
return (
<Box
{...(fluid
? { w: '100%' }
: {
maxW: { sm: 540, md: 768, lg: 960, xl: 1200 },
mx: 'auto',
px: 4,
w: '100%',
})}
{...props}
>
<Box w={col}>{props.children}</Box>
</Box>
)
}
Layout.propTypes = {
fluid: PropTypes.bool,
columns: PropTypes.any,
children: PropTypes.node,
}
Layout.defaultProps = {
fluid: false,
columns: { base: 1, md: 1, lg: 1, xl: 1 },
}