Skip to content

Commit e8546d9

Browse files
committed
✨ Support full "Holy Grail Layout" in Layout component
1 parent 2b700fd commit e8546d9

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"dependencies": {
106106
"emotion": "^9.2.6",
107107
"emotion-theming": "^9.2.6",
108-
"macro-components": "^2.0.0",
109108
"pss": "^2.0.0",
110109
"react-emotion": "^9.2.6"
111110
}

src/layout/index.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react'
2-
import Macro from 'macro-components'
32
import styled from 'react-emotion'
43
import { flexItemPropStyles } from 'pss'
54

@@ -11,26 +10,26 @@ const LayoutContent = styled(Box)(
1110
flexItemPropStyles
1211
)
1312

14-
const createLayout = Macro({
13+
const LayoutBody = styled(FlexBox)(
14+
{ display: 'flex', flexGrow: 1, flexShrink: 0, flexBasis: 'auto' },
15+
flexItemPropStyles
16+
)
17+
18+
const Layout = (props) => (
19+
<FlexBox column minHt {...props} />
20+
)
21+
22+
Object.assign(Layout, {
1523
Header: FlexBoxItem.withComponent('header'),
1624
Content: LayoutContent.withComponent('main'),
17-
Footer: FlexBoxItem.withComponent('footer')
25+
Footer: FlexBoxItem.withComponent('footer'),
26+
Item: FlexBoxItem,
27+
Body: LayoutBody
1828
})
1929

20-
const Layout = createLayout(({
21-
Header,
22-
Content,
23-
Footer
24-
}, { children, ...rest }) => (
25-
<FlexBox column minHt {...rest}>
26-
{Header}
27-
{Content}
28-
{Footer}
29-
</FlexBox>
30-
))
31-
3230
export {
3331
Layout,
3432
FlexBoxItem as LayoutItem,
35-
LayoutContent
33+
LayoutContent,
34+
LayoutBody
3635
}

yarn.lock

-4
Original file line numberDiff line numberDiff line change
@@ -6523,10 +6523,6 @@ lru-cache@^4.1.1:
65236523
pseudomap "^1.0.2"
65246524
yallist "^2.1.2"
65256525

6526-
macro-components@^2.0.0:
6527-
version "2.0.0"
6528-
resolved "https://registry.yarnpkg.com/macro-components/-/macro-components-2.0.0.tgz#08b6a14a372d79d2a2b04a72ba00baf1088bb08a"
6529-
65306526
make-dir@^1.0.0:
65316527
version "1.0.0"
65326528
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.0.0.tgz#97a011751e91dd87cfadef58832ebb04936de978"

0 commit comments

Comments
 (0)