This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
forked from supple-kit/supple-css
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_layout.scss
282 lines (224 loc) · 6.24 KB
/
_layout.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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
/* =========================================================================
objects.layout
Fluid and nestable layout system based on flexbox.
========================================================================= */
/* Variables
========================================================================= */
/**
* The default gutter
*/
$supple-layout-gutter: $supple-space !default;
$supple-layout-gutter-tiny: $supple-space-tiny !default;
$supple-layout-gutter-small: $supple-space-small !default;
$supple-layout-gutter-large: $supple-space-large !default;
$supple-layout-gutter-huge: $supple-space-huge !default;
/**
* Define which namespaced breakpoints you would like to generate for `fit` & `fill`.
* This is handy if you only need `fit` on, say, desk, or you only need `fill`
* at mobile sizes. It allows you to only compile as much CSS as you need.
* All are empty by default, but you can add breakpoints at will.
*
* $supple-breakpoint-has-layout-x: (lap, desk);
*
* Or
*
* $supple-breakpoint-has-layout-x: (
* from: lap,
* until: lap desk,
* );
*
* Note: the name of the breakpoint must exist in the list of `$mq-breakpoints`
* in `settings/responsive`
*/
$supple-breakpoint-has-layout-fit: () !default;
$supple-breakpoint-has-layout-fill: () !default;
/* Functions/Mixins
Functions and/or mixins used in this module
========================================================================= */
/**
* Modifier: Make a unit shrink wrap its content.
*/
@mixin supple-layout-fit () {
flex-basis: auto;
}
/**
* Modifier: Make a cell fill the remaining space.
*
* 1. Be explicit to work around IE10 bug with shorthand flex
* 2. IE10 ignores previous `flex-basis` value. Setting again here fixes
* 3. Fixes issue where a element doesn’t fill the remaining space when the
* container has no explicit width.
*/
@mixin supple-layout-fill () {
flex: 1 1 auto; /* [1] */
flex-basis: auto; /* [2] */
width: 0%; /* [3] */
}
/* Layout root
========================================================================= */
/**
* All content must be contained within child `layout__cell` elements.
*
* 1. Account for browser defaults of elements that might be the root node of
* the component.
*/
.o-layout {
--o-layout-columns: 12;
--o-layout-colspan: var(--o-layout-columns);
display: flex; /* [1] */
flex-flow: row wrap;
padding: 0; /* [1] */
margin-left: 0; /* [1] */
list-style: none; /* [1] */
}
/**
* Modifier: center align all layout cells
*/
.o-layout--align-center {
justify-content: center;
}
/**
* Modifier: right align all layout cells
*/
.o-layout--align-right {
justify-content: flex-end;
}
/**
* Modifier: middle-align layout cells
*/
.o-layout--align-middle {
align-items: center;
}
/**
* Modifier: bottom-align layout cells
*/
.o-layout--align-bottom {
align-items: flex-end;
}
/**
* Modifier: reverse all cells
*/
.o-layout--reverse {
flex-direction: row-reverse;
}
/**
* Modifier: allow cells to equal distribute width
*
* 1. Provide all values to avoid IE10 bug with shorthand flex
* http://git.io/vllC7
*
* Use `0%` to avoid bug in IE10/11 with unitless flex basis
* http://git.io/vllWx
*/
.o-layout--fit {
> .o-layout__cell {
flex: 1 1 0%; /* [1] */
}
}
/**
* Modifier: all cells match height of tallest cell in a row
* 1. The direct child of the flexbox must be a single element when you want
* to use equalheight
*/
.o-layout--equalheight {
> .o-layout__cell {
display: flex;
> * {
width: 100%; /* [1] */
}
}
}
/**
* Modifier: Gutter
*/
.o-layout--gutter {
@include supple-rem(margin-left, -$supple-layout-gutter);
> .o-layout__cell {
@include supple-rem(padding-left, $supple-layout-gutter);
}
}
/**
* Modifier: Tiny gutter
*/
.o-layout--gutter-tiny {
@include supple-rem(margin-left, -$supple-layout-gutter-tiny);
> .o-layout__cell {
@include supple-rem(padding-left, $supple-layout-gutter-tiny);
}
}
/**
* Modifier: Small gutter
*/
.o-layout--gutter-small {
@include supple-rem(margin-left, -$supple-layout-gutter-small);
> .o-layout__cell {
@include supple-rem(padding-left, $supple-layout-gutter-small);
}
}
/**
* Modifier: Large gutter
*/
.o-layout--gutter-large {
@include supple-rem(margin-left, -$supple-layout-gutter-large);
> .o-layout__cell {
@include supple-rem(padding-left, $supple-layout-gutter-large);
}
}
/**
* Modifier: Huge gutter
*/
.o-layout--gutter-huge {
@include supple-rem(margin-left, -$supple-layout-gutter-huge);
> .o-layout__cell {
@include supple-rem(padding-left, $supple-layout-gutter-huge);
}
}
/* Layout cell
========================================================================= */
/**
* No explicit width by default. Rely on combining `layout__cell` with a dimension
* utility or a component class that extends 'layout'.
*
* 1. Set flex items to full width by default
* 2. Fix issue where elements with overflow extend past the
* `layout__cell` container
* 3. Fallback for browsers which do not support CSS custom properties
*/
.o-layout__cell {
flex-basis: 100%; /* [3] */
flex-basis: calc(100% / var(--o-layout-columns) * var(--o-layout-colspan)); /* [1] */
min-width: 0; /* [2] */
}
/**
* Modifier: horizontally center one unit
* Set a specific unit to be horizontally centered. Doesn't affect
* any other units. Can still contain a child `layout` object.
*/
.o-layout__cell--center {
margin-left: auto;
margin-right: auto;
}
/**
* Modifier: Make a cell shrink wrap its content.
*/
.o-layout__cell--fit {
@include supple-layout-fit;
}
/**
* Modifier: Make a cell fill the remaining space.
*/
.o-layout__cell--fill {
@include supple-layout-fill;
}
/* Responsive fitters & fillers
========================================================================= */
@if (mixin-exists(supple-breakpoint-has)) {
@include supple-breakpoint-has($supple-breakpoint-has-layout-fit, '.o-layout__cell--fit') {
@include supple-layout-fit;
}
@include supple-breakpoint-has($supple-breakpoint-has-layout-fill, '.o-layout__cell--fill') {
@include supple-layout-fill;
}
} @else {
@error 'The layout object relies on the `supple-breakpoint-has` mixin. Did you include supple’s mixin file?';
}