-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_responsive.scss
More file actions
163 lines (144 loc) · 4.05 KB
/
Copy path_responsive.scss
File metadata and controls
163 lines (144 loc) · 4.05 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/********************************************
STANDARD IMPORTS
********************************************/
//Armstrong core
@import "~armstrong-react/dist/imports";
//Custom overrides of Armstrongs variables
@import "./../_armstrong.variables";
/********************************************
RESPONSIVE MIXINS
********************************************/
//// RESPONSIVE SIZE DICTIONARY
$responsive-sizes: (
large $responsive-large,
medium $responsive-medium,
small $responsive-small,
xsmall $responsive-xsmall,
);
//// BEST MIXIN IN THE WORLD
@mixin row-setup($column-number, $gutter-width) {
flex-flow: row wrap;
> div, > div.col {
flex: 0 0 (100% - ($gutter-width * ($column-number - 1))) / $column-number;
&:nth-of-type(1n) {
margin-right: $gutter-width;
}
&:nth-of-type(#{$column-number}n) {
margin-right: 0;
margin-left: 0;
}
&.span-cols {
margin-right: 0;
margin-left: 0;
flex: 0 0 100%;
}
}
}
//// REMOVE FIXED PROPERTY ON COLUMN
@mixin unfix() {
width: 100%;
max-width: none !important;
flex: initial;
flex-grow: 1;
flex-shrink: 0;
flex-basis: auto;
.btn {
margin-right: 0;
margin-bottom: $spacing-small;
margin-left: 0;
}
}
//Remove margin bottom on last col when in 1 col layout mode
@mixin margin-tidy() {
.col:last-of-type {
margin-bottom: 0;
}
}
//Center content on an element
@mixin center-content() {
margin: auto !important;
text-align: center;
}
//Add a margin below the columns
@mixin spaced() {
margin-bottom: $spacing-small !important;
}
/********************************************
DEFAULT RESPONSIVE (NO MEDIA QUERY)
********************************************/
.grid.rs-xlarge-1col > .row, .row.rs-xlarge-1col {
@include row-setup(1,3%);
@include margin-tidy();
}
.grid.rs-xlarge-2col > .row, .row.rs-xlarge-2col {
@include row-setup(2,3%);
}
.grid.rs-xlarge-3col > .row, .row.rs-xlarge-3col {
@include row-setup(3,3%);
}
.grid.rs-xlarge-4col > .row, .row.rs-xlarge-4col {
@include row-setup(4,3%);
}
.col.rs-xlarge-unfix {
@include unfix();
};
.rs-xlarge-full-width {
width: 100%;
};
.rs-xlarge-center-content {
@include center-content();
}
.grid.rs-xlarge-spaced, .row.rs-xlarge-spaced {
padding-bottom: 0 !important;
& > .row > .col, > .col {
@include spaced();
}
}
.rs-xlarge-hide {
display: none !important;
}
.rs-xlarge-show {
display: block !important;
}
/********************************************
RESPONSIVE MEDIA QUERY LOOP BEHAVIOURS
********************************************/
@each $size in $responsive-sizes {
@media (max-width: #{nth($size,2)}) {
//Do this loop for each column limit, from 1col to 4col
@for $n from 1 through 4 {
.grid.rs-#{nth($size, 1)}-#{$n}col > .row, .row.rs-#{nth($size, 1)}-#{$n}col {
@include row-setup($n,3%);
@if $n = 1 {
/// REMOVE MARGIN BOTTOM ON LAST COL WHEN IN 1 COL LAYOUT MODE
.col:last-of-type {
@include margin-tidy;
}
}
}
//Unfix a column
.col.rs-#{nth($size, 1)}-unfix {
@include unfix();
}
//Center content on an element
.rs-#{nth($size, 1)}-center-content {
@include center-content();
}
.grid.rs-#{nth($size, 1)}-spaced, .row.rs-#{nth($size, 1)}-spaced {
padding-bottom: 0 !important;
& > .row > .col, > .col {
@include spaced();
}
}
.rs-#{nth($size, 1)}-hide {
display: none !important;
}
.rs-#{nth($size, 1)}-show {
display: block !important;
}
.rs-#{nth($size, 1)}-full-width {
width: 100%;
};
}
}
}