-
Notifications
You must be signed in to change notification settings - Fork 4
/
griz.js
72 lines (69 loc) · 1.75 KB
/
griz.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
67
68
69
70
71
72
import styled, { css } from 'styled-components';
const gutterWidth = 10;
const responsiveSmBreak = '567px';
const responsiveMdBreak = '767px';
const responsiveLgBreak = '1023px';
export const GridCol = styled.div`
display: block;
flex: 1;
width: 100%;
${props => props.column && css`
flex: 0 0 ${props.column}%;
max-width: ${props.column}%;
`}
${props => props.offset && css`
margin-left: ${props.offset}%;
`}
`;
export const Grid = styled.div`
display: flex;
flex-flow: row wrap;
width: 100%;
& + &{
margin-top: ${props => ((props.gutterWidth || gutterWidth) / 2) * -1}px;
padding-top: 0;
}
padding: ${props => (props.gutterWidth || gutterWidth) / 2}px;
> ${GridCol}{
padding: ${props => (props.gutterWidth || gutterWidth) / 2}px;
}
@media (max-width: ${responsiveSmBreak}){
${props => props.responsiveSm && css`
flex-direction: column;
> ${GridCol}{
margin-bottom: ${((props.gutterWidth || gutterWidth) * 3) / 2}px;
margin-left: 0;
max-width: 100%;
width: 100%;
}
`}
}
@media (max-width: ${responsiveMdBreak}){
${props => props.responsiveMd && css`
flex-direction: column;
> ${GridCol}{
margin-bottom: ${((props.gutterWidth || gutterWidth) * 3) / 2}px;
margin-left: 0;
max-width: 100%;
width: 100%;
}
`}
}
@media (max-width: ${responsiveLgBreak}){
${props => props.responsiveLg && css`
flex-direction: column;
> ${GridCol}{
margin-bottom: ${((props.gutterWidth || gutterWidth) * 3) / 2}px;
margin-left: 0;
max-width: 100%;
width: 100%;
}
`}
}
${props => props.gutterless && css`
padding: 0;
> ${GridCol}{
padding: 0;
}
`}
`;