forked from emotion-js/emotion
/
Box.js
66 lines (63 loc) · 1.27 KB
/
Box.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// @flow
import styled from '@emotion/styled'
import {
space,
width,
fontSize,
color,
responsiveStyle,
flex
} from 'styled-system'
export const display = responsiveStyle('display')
export const order = responsiveStyle('order')
const wrap = responsiveStyle('flexWrap', 'wrap', 'wrap')
const direction = responsiveStyle('flexDirection', 'direction')
const align = responsiveStyle('alignItems', 'align')
const justify = responsiveStyle('justifyContent', 'justify')
const overflow = responsiveStyle('overflow', 'overflow')
const column = props => (props.column ? 'flex-direction:column;' : null)
/**
* This is an optimized version of
*
* export default styled.div`
* ${display};
* ${space};
* ${width};
* ${fontSize};
* ${color};
* ${flex};
* ${order};
* ${wrap};
* ${column};
* ${direction};
* ${align};
* ${justify};
* `
*/
type Props = $Shape<{
className: ?string,
flex: number | string,
children: React$Node,
direction: Array<string>,
css: { [string]: number | string },
display: string,
fontSize: string | number,
justify: string,
align: string
}>
const Box = styled.div<Props>(
display,
space,
width,
fontSize,
color,
flex,
order,
wrap,
column,
direction,
align,
justify,
overflow
)
export default Box