-
Notifications
You must be signed in to change notification settings - Fork 0
/
inuit-columns.scss
186 lines (129 loc) · 4.74 KB
/
inuit-columns.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
/* ========================================================================
#COLUMNS
======================================================================== */
/**
* Utility to apply multi-column for the Inuitcss framework.
*
* It generate helper clasess, e.g.:
* .u-columns-2
* .u-columns-3
* .u-columns-4
*
* By default, it apply half of columns count on tablets and below. You
* can change this below.
*
* By default, it apply simple columns until mobile. You
* can change this below.
*
* TODO: REVISAR DOC-COMMENTS SOBRE ESPACIADOS
*
* If we’re using Sass-MQ, automatically generate responsive helpers for each of our
* defined breakpoints, and give them a Responsive Suffix, e.g.:
*
* .u-columns-2@mobile
* .u-columns-3@tablet
*/
// A list of columns count that get generated as helper classes.
$inuit-columns-count-list: (
2,
3,
4,
6
) !default;
// The utility apply half of columns count on tablets and below. If you desire more
// control you can set it to false.
$inuit-columns-half-of-columns-count-on-tablet: true;
// For the function apply half of columns count on tablets: type of Sass round:
// ceil (rounds a number up to the next whole number) or
// floor (rounds a number down to the previous whole number).
$inuit-columns-count-decrease-round-type: ceil;
// The utility apply simple column until mobile. If you desire more
// control you can set it to false.
$inuit-columns-simple-column-until-mobile: true;
// Widths of gaps modifiers
$inuit-columns-gap-tiny: 5px !default;
$inuit-columns-gap-small: 10px !default;
$inuit-columns-gap-normal: 20px !default;
$inuit-columns-gap-large: 40px !default;
$inuit-columns-gap-huge: 60px !default;
// Optionally we can use the Inuitcss global spacing units
$inuit-columns-activate-inuit-global-spacing-unit: false;
///* ========================================================================
// #COLUMNS-count
// ======================================================================== */
// Mixin to generate columns count helper classes.
@mixin inuit-columns-counts($column-count-list: $inuit-columns-count-list, $breakpoint: null) {
@each $column-count in $column-count-list {
// Make a rule in the format `.u-columns-2`.
$rule: ".u-columns-#{$column-count}#{$breakpoint}";
#{unquote($rule)} {
column-count: $column-count;
}
// Tablet's columns count
@if $inuit-columns-half-of-columns-count-on-tablet == true {
@include mq($until: tablet) {
#{unquote($rule)} {
// Ceil or floor Sass round type
@if $inuit-columns-count-decrease-round-type == ceil {
column-count: ceil($column-count / 2);
}
@if $inuit-columns-count-decrease-round-type == floor {
column-count: floor($column-count / 2);
}
}
}
}
}
}
///* ========================================================================
// #
// ======================================================================== */
//
@if $inuit-columns-activate-inuit-global-spacing-unit == true {
@if (variable-exists(inuit-global-spacing-unit)) {
$inuit-columns-gap-tiny: $inuit-global-spacing-unit-tiny;
$inuit-columns-gap-small: $inuit-global-spacing-unit-small;
$inuit-columns-gap-normal: $inuit-global-spacing-unit;
$inuit-columns-gap-large: $inuit-global-spacing-unit-large;
$inuit-columns-gap-huge: $inuit-global-spacing-unit-huge;
}
}
// Apply normal column gap by default.
*[class^="u-columns-"],
*[class*=" u-columns-"] {
column-gap: $inuit-columns-gap-normal;
}
// Apply simple columns on mobile by default.
@if $inuit-columns-simple-column-until-mobile == true {
@include mq($until: mobile) {
*[class^="u-columns-"],
*[class*=" u-columns-"] {
column-count: 1 !important;
}
}
}
// Include column count helper creator mixin.
@include inuit-columns-counts($inuit-columns-count-list);
// Generate responsive helpers for each of our defined breakpoints
@if (variable-exists(mq-breakpoints)) {
@each $inuit-bp-name, $inuit-bp-value in $mq-breakpoints {
@include mq($from: $inuit-bp-name) {
@include inuit-columns-counts($inuit-columns-count-list, \@#{$inuit-bp-name});
}
}
}
// Declare gaps widths helper classes.
.u-columns-gap {
&-tiny {
column-gap: $inuit-columns-gap-tiny;
}
&-small {
column-gap: $inuit-columns-gap-small;
}
&-large {
column-gap: $inuit-columns-gap-large;
}
&-huge {
column-gap: $inuit-columns-gap-huge;
}
}