-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathgrid.scss
72 lines (67 loc) · 1.48 KB
/
grid.scss
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
$grid__bp-sm: 576;
$grid__bp-md: 768;
$grid__bp-lg: 992;
$grid__bp-xl: 1200;
$grid__cols: 12;
$map-grid-props: (
'': 0,
'-sm': $grid__bp-sm,
'-md': $grid__bp-md,
'-lg': $grid__bp-lg,
'-xl': $grid__bp-xl
);
@mixin create-mq($breakpoint, $min-or-max) {
@if($breakpoint == 0) {
@content;
} @else {
@media screen and (#{$min-or-max}-width: $breakpoint *1px) {
@content;
}
}
}
@mixin create-col-classes($modifier, $grid-cols, $breakpoint) {
@include create-mq($breakpoint, 'min') {
&__col#{$modifier}-offset-0 {
margin-left: 0;
}
@for $i from 1 through $grid-cols {
&__col#{$modifier}-#{$i} {
flex-basis: (100 / ($grid-cols / $i) ) * 1%;
}
&__col#{$modifier}-offset-#{$i} {
margin-left: (100 / ($grid-cols / $i) ) * 1%;
}
}
}
}
@each $modifier , $breakpoint in $map-grid-props {
@if($modifier == '') {
$modifier: '-xs';
}
@include create-mq($breakpoint - 1, 'max') {
.hidden#{$modifier}-down {
display: none !important;
}
}
@include create-mq($breakpoint, 'min') {
.hidden#{$modifier}-up {
display: none !important;
}
}
}
.container {
max-width: $grid__bp-md * 1px;
margin: 0 auto;
&--fluid {
margin: 0;
max-width: 100%;
}
&__row {
display: flex;
flex-wrap: wrap;
width: 100%;
}
@each $modifier , $breakpoint in $map-grid-props {
@include create-col-classes($modifier, $grid__cols, $breakpoint);
}
}