/
_base_grid-definitions.scss
101 lines (83 loc) · 2.54 KB
/
_base_grid-definitions.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@mixin vf-b-row-reset {
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
}
@mixin vf-b-grid-definitions {
%fixed-width-container {
@extend %vf-grid-container-padding;
margin-left: auto;
margin-right: auto;
max-width: $grid-max-width;
width: 100%;
}
%vf-row {
@extend %fixed-width-container;
// default to flexbox for IE
display: flex;
flex-wrap: wrap;
& & {
@include vf-b-row-reset;
}
@supports (display: grid) {
display: grid;
grid-template-rows: auto;
margin-left: auto;
margin-right: auto;
max-width: $grid-max-width;
[class*='#{$grid-column-prefix}'] {
grid-column-start: auto;
}
// set static gutter width per breakpoint
@media (max-width: $threshold-4-6-col) {
grid-gap: 0 map-get($grid-gutter-widths, small);
grid-template-columns: repeat($grid-columns-small, minmax(0, 1fr));
& > * {
grid-column-end: span $grid-columns-small;
}
}
@media (min-width: $threshold-4-6-col) and (max-width: $threshold-6-12-col) {
grid-gap: 0 map-get($grid-gutter-widths, medium);
grid-template-columns: repeat($grid-columns-medium, minmax(0, 1fr));
& > * {
grid-column-end: span $grid-columns-medium;
}
}
@media (min-width: $threshold-6-12-col) {
grid-gap: 0 map-get($grid-gutter-widths, large);
grid-template-columns: repeat($grid-columns, minmax(0, 1fr));
& > * {
grid-column-end: span $grid-columns;
}
}
}
}
%vf-grid-container-padding {
// set static outside padding per breakpoint
@media (max-width: $threshold-4-6-col) {
padding-left: map-get($grid-margin-widths, small);
padding-right: map-get($grid-margin-widths, small);
}
@media (min-width: $threshold-4-6-col) and (max-width: $threshold-6-12-col) {
padding-left: map-get($grid-margin-widths, medium);
padding-right: map-get($grid-margin-widths, medium);
}
@media (min-width: $threshold-6-12-col) {
padding-left: map-get($grid-margin-widths, large);
padding-right: map-get($grid-margin-widths, large);
}
}
}
// flexbox approximation of grid column styles for IE
// this needs to be a @mixin rather than %placeholder because it's ised inside @media queries
@mixin vf-grid-flex-column {
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
// set static gutter width
margin-left: map-get($grid-gutter-widths, large);
&:first-child {
margin-left: 0;
}
}