GIPainter-base 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,109 +1,109 @@
1
- //-----------------------------------
2
- // PSEUDO ELEMENTS MIXINS
3
- //-----------------------------------
4
-
5
- ////
6
- /// @access public
7
- /// @group Mixins
8
- /// @type string
9
- ////
10
-
11
- /// Mixin helper set pseudo element.
12
- /// @param {String} $display [block] - display of you pseudo element
13
- /// @param {String} $pos [absolute] - position of your pseudo element
14
- /// @param {String} $content [''] - content of your pseudo element
15
- /// @example scss - Usage
16
- /// .foo:after {
17
- /// @include pseudo;
18
- /// }
19
- /// @example css - Result
20
- /// .foo:after {
21
- /// content: '';
22
- /// display: block;
23
- /// position: absolute;
24
- /// }
25
-
26
- @mixin pseudo($display: block, $pos: absolute, $content: ''){
27
- @if type-of($pos) == list {
28
- $coordinates: $pos;
29
- $position: relative;
30
- }
31
- position: $pos;
32
- content: $content;
33
- display: $display;
34
- }
35
-
36
- /// Mixin helper to add clearfix pseudo elements
37
- /// @param {String} $elements [after] - pseudo element selected (before, after)
38
- /// @example scss - Usage
39
- /// .foo {
40
- /// @include clearfix(before);
41
- /// }
42
- /// @example css - Result
43
- /// .foo:before {
44
- /// display: table;
45
- /// content: "";
46
- /// position: static;
47
- /// clear: both;
48
- /// }
49
-
50
- @mixin clearfix ($elements: after) {
51
- &:#{$elements}{
52
- @include pseudo(table, static);
53
- clear: both;
54
- }
55
- }
56
-
57
- /// Mixin helper to add clearfix pseudo elements
58
- /// @param {Color} $color - color you want set to your triangle
59
- /// @param {string} $direction - direction of your triangle (top, bottom, right, left)
60
- /// @param {Length} $size [6px] - your triangle size
61
- /// @param {string} $position [absolute] - position for your triangle (absolute, static, etc...)
62
- /// @param {Length} $round [false] - radius of your triangle
63
- /// @example scss - Usage
64
- /// .foo:before {
65
- /// @include triangle(red, bottom, $round: 3px);
66
- /// }
67
- /// @example css - Result
68
- /// .foo:before {
69
- /// display: block;
70
- /// content: "";
71
- /// position: absolute;
72
- /// width: 0;
73
- /// height: 0;
74
- /// border-radius: 3px;
75
- /// border-left: 6px solid transparent;
76
- /// border-right: 6px solid transparent;
77
- /// border-top: 6px solid red;
78
- /// margin-top: -2.4px;
79
- /// }
80
-
81
- @mixin triangle($color, $direction, $size: 6px, $position: absolute, $round: false){
82
- @include pseudo($pos: $position);
83
- width: 0;
84
- height: 0;
85
- @if $round {
86
- border-radius: $round;
87
- }
88
- @if $direction == bottom {
89
- border-left: $size solid transparent;
90
- border-right: $size solid transparent;
91
- border-top: $size solid $color;
92
- margin-top: 0 - round( $size / 2.5 );
93
- } @else if $direction == top {
94
- border-left: $size solid transparent;
95
- border-right: $size solid transparent;
96
- border-bottom: $size solid $color;
97
- margin-bottom: 0 - round( $size / 2.5 );
98
- } @else if $direction == right {
99
- border-top: $size solid transparent;
100
- border-bottom: $size solid transparent;
101
- border-left: $size solid $color;
102
- margin-right: -$size;
103
- } @else if $direction == left {
104
- border-top: $size solid transparent;
105
- border-bottom: $size solid transparent;
106
- border-right: $size solid $color;
107
- margin-left: -$size;
108
- }
1
+ //-----------------------------------
2
+ // PSEUDO ELEMENTS MIXINS
3
+ //-----------------------------------
4
+
5
+ ////
6
+ /// @access public
7
+ /// @group Mixins
8
+ /// @type string
9
+ ////
10
+
11
+ /// Mixin helper set pseudo element.
12
+ /// @param {String} $display [block] - display of you pseudo element
13
+ /// @param {String} $pos [absolute] - position of your pseudo element
14
+ /// @param {String} $content [''] - content of your pseudo element
15
+ /// @example scss - Usage
16
+ /// .foo:after {
17
+ /// @include pseudo;
18
+ /// }
19
+ /// @example css - Result
20
+ /// .foo:after {
21
+ /// content: '';
22
+ /// display: block;
23
+ /// position: absolute;
24
+ /// }
25
+
26
+ @mixin pseudo($display: block, $pos: absolute, $content: ''){
27
+ @if type-of($pos) == list {
28
+ $coordinates: $pos;
29
+ $position: relative;
30
+ }
31
+ position: $pos;
32
+ content: $content;
33
+ display: $display;
34
+ }
35
+
36
+ /// Mixin helper to add clearfix pseudo elements
37
+ /// @param {String} $elements [after] - pseudo element selected (before, after)
38
+ /// @example scss - Usage
39
+ /// .foo {
40
+ /// @include clearfix(before);
41
+ /// }
42
+ /// @example css - Result
43
+ /// .foo:before {
44
+ /// display: table;
45
+ /// content: "";
46
+ /// position: static;
47
+ /// clear: both;
48
+ /// }
49
+
50
+ @mixin clearfix ($elements: after) {
51
+ &:#{$elements}{
52
+ @include pseudo(table, static);
53
+ clear: both;
54
+ }
55
+ }
56
+
57
+ /// Mixin helper to add clearfix pseudo elements
58
+ /// @param {Color} $color - color you want set to your triangle
59
+ /// @param {string} $direction - direction of your triangle (top, bottom, right, left)
60
+ /// @param {Length} $size [6px] - your triangle size
61
+ /// @param {string} $position [absolute] - position for your triangle (absolute, static, etc...)
62
+ /// @param {Length} $round [false] - radius of your triangle
63
+ /// @example scss - Usage
64
+ /// .foo:before {
65
+ /// @include triangle(red, bottom, $round: 3px);
66
+ /// }
67
+ /// @example css - Result
68
+ /// .foo:before {
69
+ /// display: block;
70
+ /// content: "";
71
+ /// position: absolute;
72
+ /// width: 0;
73
+ /// height: 0;
74
+ /// border-radius: 3px;
75
+ /// border-left: 6px solid transparent;
76
+ /// border-right: 6px solid transparent;
77
+ /// border-top: 6px solid red;
78
+ /// margin-top: -2.4px;
79
+ /// }
80
+
81
+ @mixin triangle($color, $direction, $size: 6px, $position: absolute, $round: false){
82
+ @include pseudo($pos: $position);
83
+ width: 0;
84
+ height: 0;
85
+ @if $round {
86
+ border-radius: $round;
87
+ }
88
+ @if $direction == bottom {
89
+ border-left: $size solid transparent;
90
+ border-right: $size solid transparent;
91
+ border-top: $size solid $color;
92
+ margin-top: 0 - round( $size / 2.5 );
93
+ } @else if $direction == top {
94
+ border-left: $size solid transparent;
95
+ border-right: $size solid transparent;
96
+ border-bottom: $size solid $color;
97
+ margin-bottom: 0 - round( $size / 2.5 );
98
+ } @else if $direction == right {
99
+ border-top: $size solid transparent;
100
+ border-bottom: $size solid transparent;
101
+ border-left: $size solid $color;
102
+ margin-right: -$size;
103
+ } @else if $direction == left {
104
+ border-top: $size solid transparent;
105
+ border-bottom: $size solid transparent;
106
+ border-right: $size solid $color;
107
+ margin-left: -$size;
108
+ }
109
109
  }
@@ -1,73 +1,73 @@
1
- //-----------------------------------
2
- // IMAGE MIXINS
3
- //-----------------------------------
4
-
5
- ////
6
- /// @access public
7
- /// @group Mixins
8
- /// @type string
9
- ////
10
-
11
- /// Mixin helper set responsive ratio.
12
- /// @param {Length} $x - width of you image/media/block
13
- /// @param {Length} $y - height of you image/media/block
14
- /// @param {Boolean} $pseudo [false] - set true to make pseudo element with repsonsive ratio
15
- /// @example scss - Usage
16
- /// .foo {
17
- /// @include responsive-ratio(1,1, true);
18
- /// }
19
- /// @example css - Result
20
- /// .foo:before {
21
- /// display: block;
22
- /// position: relative;
23
- /// content: '';
24
- /// width: 100%;
25
- /// padding-top: 100%;
26
- /// }
27
-
28
- @mixin responsive-ratio($x,$y, $pseudo: false) {
29
- $padding: unquote( ( $y / $x ) * 100 + '%' );
30
- @if $pseudo {
31
- &:before {
32
- @include pseudo($pos: relative);
33
- width: 100%;
34
- padding-top: $padding;
35
- }
36
- } @else {
37
- padding-top: $padding;
38
- }
39
- }
40
-
41
- /// Mixin helper to sizing element
42
- /// @param {Length} $width [auto] - element width
43
- /// @param {Length} $height [auto] - element height
44
- /// @example scss - Usage
45
- /// .foo {
46
- /// @include size(300px, 30px);
47
- /// }
48
- /// @example css - Result
49
- /// .foo {
50
- /// width: 300px;
51
- /// height: 30px;
52
- /// }
53
-
54
- @mixin size($width: auto, $height: auto){
55
- width: $width;
56
- height: $height;
57
- }
58
-
59
- /// Mixin helper to sizing element square
60
- /// @param {Length} $size [auto] - element size
61
- /// @example scss - Usage
62
- /// .foo {
63
- /// @include square(300px);
64
- /// }
65
- /// @example css - Result
66
- /// .foo {
67
- /// width: 300px;
68
- /// height: 300px;
69
- /// }
70
-
71
- @mixin square($size: auto) {
72
- @include size($size, $size);
1
+ //-----------------------------------
2
+ // IMAGE MIXINS
3
+ //-----------------------------------
4
+
5
+ ////
6
+ /// @access public
7
+ /// @group Mixins
8
+ /// @type string
9
+ ////
10
+
11
+ /// Mixin helper set responsive ratio.
12
+ /// @param {Length} $x - width of you image/media/block
13
+ /// @param {Length} $y - height of you image/media/block
14
+ /// @param {Boolean} $pseudo [false] - set true to make pseudo element with repsonsive ratio
15
+ /// @example scss - Usage
16
+ /// .foo {
17
+ /// @include responsive-ratio(1,1, true);
18
+ /// }
19
+ /// @example css - Result
20
+ /// .foo:before {
21
+ /// display: block;
22
+ /// position: relative;
23
+ /// content: '';
24
+ /// width: 100%;
25
+ /// padding-top: 100%;
26
+ /// }
27
+
28
+ @mixin responsive-ratio($x,$y, $pseudo: false) {
29
+ $padding: unquote( ( $y / $x ) * 100 + '%' );
30
+ @if $pseudo {
31
+ &:before {
32
+ @include pseudo($pos: relative);
33
+ width: 100%;
34
+ padding-top: $padding;
35
+ }
36
+ } @else {
37
+ padding-top: $padding;
38
+ }
39
+ }
40
+
41
+ /// Mixin helper to sizing element
42
+ /// @param {Length} $width [auto] - element width
43
+ /// @param {Length} $height [auto] - element height
44
+ /// @example scss - Usage
45
+ /// .foo {
46
+ /// @include size(300px, 30px);
47
+ /// }
48
+ /// @example css - Result
49
+ /// .foo {
50
+ /// width: 300px;
51
+ /// height: 30px;
52
+ /// }
53
+
54
+ @mixin size($width: auto, $height: auto){
55
+ width: $width;
56
+ height: $height;
57
+ }
58
+
59
+ /// Mixin helper to sizing element square
60
+ /// @param {Length} $size [auto] - element size
61
+ /// @example scss - Usage
62
+ /// .foo {
63
+ /// @include square(300px);
64
+ /// }
65
+ /// @example css - Result
66
+ /// .foo {
67
+ /// width: 300px;
68
+ /// height: 300px;
69
+ /// }
70
+
71
+ @mixin square($size: auto) {
72
+ @include size($size, $size);
73
73
  }
@@ -1,371 +1,376 @@
1
- //-----------------------------------
2
- // TYPOGRAPHY MIXINS
3
- //-----------------------------------
4
-
5
- ////
6
- /// @access public
7
- /// @group Mixins
8
- /// @type string
9
- ////
10
-
11
- /// Mixin helper to convert font-size pixel to rem.
12
- /// @param {Number} $font-size [14] - font-size in pixel
13
- /// @example scss - Usage
14
- /// .foo {
15
- /// @include font-size(16px);
16
- /// }
17
- /// @example css - Result
18
- /// .foo {
19
- /// font-size: 16px;
20
- /// font-size: 1.142857rem;
21
- /// }
22
-
23
- @mixin font-size($font-size: 14) {
24
- font-size: $font-size;
25
- font-size: ($font-size / $font-size-base) * 1rem;
26
- }
27
-
28
- /// Mixin helper to Generates line-height values in both pixels and rems.
29
- /// @param {Number} $height-value [14] - Height value
30
- /// @example scss - Usage
31
- /// .foo {
32
- /// @include line-height(14);
33
- /// }
34
- /// @example css - Result
35
- /// .foo {
36
- /// line-height: 14px;
37
- /// line-height: 1rem;
38
- /// }
39
- @mixin line-height($height-value: 14) {
40
- line-height: $height-value;
41
- line-height: ($height-value / $font-size-base) * 1rem;
42
- }
43
-
44
- /// Mixin helper to output '@font-face'
45
- /// @param {String} $font-family - font-family name
46
- /// @param {String} $file-path - path to file without extension
47
- /// @param {String} $weight [normal] - weight of your font (bold, normal, 100, etc...)
48
- /// @param {String} $style [normal] - style of your font (italic, oblique, normal, etc...)
49
- /// @param {Array} $formats [eot woff2 woff ttf svg] - formats of your font files
50
- /// @example scss - Usage
51
- /// @include font-face("Arvo", "fonts/arvo-regular-webfont");
52
- /// @example css - Result
53
- /// @font-face {
54
- /// font-family: "Arvo";
55
- /// font-weight: normal;
56
- /// font-style: normal;
57
- /// src: url('fonts/arvo-regular-webfont.eot');
58
- /// src: url('fonts/arvo-regular-webfont.eot?#iefix') format('embedded-opentype'),
59
- /// url('fonts/arvo-regular-webfont.woff2') format('woff2'),
60
- /// url('fonts/arvo-regular-webfont.woff') format('woff'),
61
- /// url('fonts/arvo-regular-webfont.ttf') format('truetype'),
62
- /// url('fonts/arvo-regular-webfont.svg#svgFontName') format('svg');
63
- /// }
64
-
65
- @mixin font-face ($font-family, $file-path, $weight: normal, $style: normal, $formats: eot woff2 woff ttf svg) {
66
- @if index('italic' 'oblique', $weight) {
67
- $style: $weight;
68
- $weight: normal;
69
- }
70
-
71
- @font-face {
72
- font-family: $font-family;
73
- font-weight: $weight;
74
- font-style: $style;
75
-
76
- @if index($formats, eot) {
77
- src: url('#{$file-path}.eot');
78
- }
79
- src: font-src($formats, $file-path, $font-family);
80
- }
81
- }
82
-
83
- /// Mixin helper to indent first line of paragraphe text
84
- /// @param {Length} $indent [1.5em] - Indentation size
85
- /// @example scss - Usage
86
- /// .foo {
87
- /// @include indent-text();
88
- /// }
89
- /// @example css - Result
90
- /// .foo {
91
- /// margin: 0;
92
- /// text-indent: 1.5em;
93
- /// }
94
-
95
- @mixin indent-text ($indent: 1.5em) {
96
- p {
97
- margin: 0;
98
- text-indent: $indent;
99
- }
100
- }
101
-
102
- /// Mixin helper to replace underline of link with border-bottom
103
- /// @param {Color} $color [inherit] - color of border
104
- /// @param {string} $style [solid] - style of border
105
- /// @param {Length} $width [1px] - size of border
106
- /// @example scss - Usage
107
- /// .foo {
108
- /// @include link-replace-underline(red, dotted);
109
- /// }
110
- /// @example css - Result
111
- /// .foo {
112
- /// text-decoration: none;
113
- /// border-bottom-width: 1px;
114
- /// border-bottom-style: dotted;
115
- /// border-bottom-color: red;
116
- /// }
117
-
118
- @mixin link-replace-underline ($color: inherit, $style: solid, $width: 1px) {
119
- text-decoration: none;
120
- border-bottom-width: $width;
121
- border-bottom-style: $style;
122
- @if $color != inherit {
123
- border-bottom-color: $color;
124
- }
125
- }
126
-
127
- /// Mixin helper to add side line arround text
128
- /// @param {Length} $height [1px] - height of side lines
129
- /// @param {Length} $space [0.5em] - space around text
130
- /// @param {Color} $color [inherit] - color of side lines
131
- /// @param {string} $style [solid] - styles of side lines
132
- /// @param {Length} $v-adjust [false] - adjust verticality
133
- /// @param {Length} $double [false] - size between 2 lines in same side
134
- /// @example scss - Usage
135
- /// .foo {
136
- /// @include side-lined(5px, $color: red, $double: 0.3em);
137
- /// }
138
- /// @example css - Result
139
- /// .foo {
140
- /// display: block;
141
- /// overflow: hidden;
142
- /// text-align: center;
143
- /// }
144
- /// .foo:before,
145
- /// .foo:after {
146
- /// content: "";
147
- /// display: inline-block;
148
- /// vertical-align: middle;
149
- /// position: relative;
150
- /// width: 50%;
151
- /// border-top-style: solid;
152
- /// border-top-width: 5px;
153
- /// border-top-color: red;
154
- /// height: 0.3em;
155
- /// border-bottom-style: solid;
156
- /// border-bottom-width: 5px;
157
- /// border-bottom-color: $color;
158
- /// }
159
-
160
- @mixin side-lined ($height: 1px, $space: 0.5em, $color: inherit, $style: solid, $v-adjust: false, $double: false) {
161
- display: block;
162
- overflow: hidden;
163
- text-align: center;
164
-
165
- &:before,
166
- &:after {
167
- content: "";
168
- display: inline-block;
169
- vertical-align: middle;
170
- position: relative;
171
- width: 50%;
172
-
173
- border-top-style: $style;
174
- border-top-width: $height;
175
-
176
- @if $color != inherit {
177
- border-top-color: $color;
178
- }
179
-
180
- @if $v-adjust != false {
181
- bottom: $v-adjust;
182
- }
183
-
184
- @if $double != false {
185
- height: $double;
186
- border-bottom-style: $style;
187
- border-bottom-width: $height;
188
- @if $color != inherit {
189
- border-bottom-color: $color;
190
- }
191
- }
192
- }
193
-
194
- &:before {
195
- right: $space;
196
- margin-left: -50%;
197
- }
198
- &:after {
199
- left: $space;
200
- margin-right: -50%;
201
- }
202
- }
203
-
204
- /// Mixin helper to truncate text
205
- /// @param {Length} $truncation-boundary - Max size of your container
206
- /// @example scss - Usage
207
- /// .foo {
208
- /// @include truncate(100%);
209
- /// }
210
- /// @example css - Result
211
- /// .foo {
212
- /// max-width: 100%;
213
- /// white-space: nowrap;
214
- /// overflow: hidden;
215
- /// text-overflow: ellipsis;
216
- /// }
217
-
218
- @mixin truncate {
219
- white-space: nowrap;
220
- overflow: hidden;
221
- text-overflow: ellipsis;
222
- }
223
-
224
- /// Mixin helper to get action selector
225
- /// @param {Boolean} $active [false] - add active selector
226
- /// @example scss - Usage
227
- /// .foo {
228
- /// @include selected {
229
- /// background-color: red;
230
- /// }
231
- /// }
232
- /// @example css - Result
233
- /// .foo:hover,
234
- /// .foo:focus{
235
- /// background-color: red;
236
- /// }
237
-
238
- @mixin selected ($active: false) {
239
- @if $active {
240
- &:hover,
241
- &:focus,
242
- &:active {
243
- @content;
244
- }
245
- }
246
- @else {
247
- &:hover,
248
- &:focus {
249
- @content;
250
- }
251
- }
252
- }
253
-
254
- /// Mixin helper to hide text
255
- /// @param {Boolean} $break [false] - set to true to break element
256
- /// @param {Length} $indent [200%] - indentation text
257
- /// @param {String} $align [left] - text alignement
258
- /// @param {String} $overflow [hidden] - overflow of element
259
- /// @example scss - Usage
260
- /// .foo {
261
- /// @include hide-text;
262
- /// }
263
- /// @example css - Result
264
- /// .foo{
265
- /// text-indent: $indent;
266
- /// text-align: $align;
267
- /// font-size: 0;
268
- /// white-space: nowrap;
269
- /// overflow: $overflow;
270
- /// }
271
-
272
- @mixin hide-text($break: false, $indent: 200%, $align: left, $overflow: hidden) {
273
- @if $break {
274
- position: absolute;
275
- top: 0; left: 0;
276
- pointer-events: none;
277
- }
278
- text-indent: $indent;
279
- text-align: $align;
280
- font-size: 0;
281
- white-space: nowrap;
282
- @if $overflow {
283
- overflow: $overflow;
284
- }
285
- }
286
-
287
- /// Mixin helper to replace text with image
288
- /// @param {Length} $w - width of element
289
- /// @param {Length} $h - height of element
290
- /// @param {String} $file - file path
291
- /// @param {String} $overflow [hidden] - overflow of element
292
- /// @example scss - Usage
293
- /// .foo {
294
- /// @include hide-text;
295
- /// }
296
- /// @example css - Result
297
- /// .foo{
298
- /// text-indent: $indent;
299
- /// text-align: $align;
300
- /// font-size: 0;
301
- /// white-space: nowrap;
302
- /// overflow: $overflow;
303
- /// }
304
-
305
- @mixin text-replacement($w, $h, $file, $overflow: hidden) {
306
- @include responsive-ratio($w, $h, true);
307
- position: relative;
308
- max-width: $w * 1px;
309
- background: url($file) 50% 50% no-repeat;
310
- background-size: contain;
311
- @include hide-text($overflow: $overflow);
312
- }
313
-
314
- /// Mixin helper to color text
315
- /// @param {Color} $color - color of your text
316
- /// @example scss - Usage
317
- /// .foo {
318
- /// @include text-emphasis-variant(#c51c1c)
319
- /// }
320
- /// @example css - Result
321
- /// .foo{
322
- /// color: #c51c1c;
323
- /// }
324
- ///
325
- /// .foo a{
326
- /// text-decoration: none;
327
- /// border-bottom-width: 1px;
328
- /// border-bottom-style: dotted;
329
- /// border-bottom-color: red;
330
- /// }
331
- ///
332
- /// .foo a:hover{
333
- /// color: #941515;
334
- /// }
335
-
336
- @mixin text-emphasis-variant($color) {
337
- color: $color;
338
-
339
- a{
340
- @include link-replace-underline;
341
-
342
- &:hover {
343
- color: darken($color, 20%);
344
- }
345
- }
346
- }
347
-
348
- /// Mixin helper to replace text with image
349
- /// @param {Length} $w - width of element
350
- /// @param {Length} $h - height of element
351
- /// @param {String} $file - file path
352
- /// @param {String} $overflow [hidden] - overflow of element
353
- /// @example scss - Usage
354
- /// .foo {
355
- /// @include hide-text;
356
- /// }
357
- /// @example css - Result
358
- /// .foo{
359
- /// text-indent: $indent;
360
- /// text-align: $align;
361
- /// font-size: 0;
362
- /// white-space: nowrap;
363
- /// overflow: $overflow;
364
- /// }
365
-
366
- @mixin lead($font-size) {
367
- margin-bottom: $line-height-computed;
368
- @include font-size($font-size);
369
- @include line-height($font-size);
370
- font-weight: 300;
1
+ //-----------------------------------
2
+ // TYPOGRAPHY MIXINS
3
+ //-----------------------------------
4
+
5
+ ////
6
+ /// @access public
7
+ /// @group Mixins
8
+ /// @type string
9
+ ////
10
+
11
+ /// Mixin helper to convert font-size pixel to rem.
12
+ /// @param {Number} $font-size [14] - font-size in pixel
13
+ /// @example scss - Usage
14
+ /// .foo {
15
+ /// @include font-size(16px);
16
+ /// }
17
+ /// @example css - Result
18
+ /// .foo {
19
+ /// font-size: 16px;
20
+ /// font-size: 1.142857rem;
21
+ /// }
22
+
23
+ @mixin font-size($font-size: 14) {
24
+ font-size: $font-size;
25
+ font-size: ($font-size / $font-size-base) * 1rem;
26
+ }
27
+
28
+ /// Mixin helper to Generates line-height values in both pixels and rems.
29
+ /// @param {Number} $height-value [14] - Height value
30
+ /// @example scss - Usage
31
+ /// .foo {
32
+ /// @include line-height(14);
33
+ /// }
34
+ /// @example css - Result
35
+ /// .foo {
36
+ /// line-height: 14px;
37
+ /// line-height: 1rem;
38
+ /// }
39
+ @mixin line-height($height-value: 14) {
40
+ line-height: $height-value;
41
+ line-height: ($height-value / $font-size-base) * 1rem;
42
+ }
43
+
44
+ /// Mixin helper to output '@font-face'
45
+ /// @param {String} $font-family - font-family name
46
+ /// @param {String} $file-path - path to file without extension
47
+ /// @param {String} $weight [normal] - weight of your font (bold, normal, 100, etc...)
48
+ /// @param {String} $style [normal] - style of your font (italic, oblique, normal, etc...)
49
+ /// @param {Array} $formats [eot woff2 woff ttf svg] - formats of your font files
50
+ /// @example scss - Usage
51
+ /// @include font-face("Arvo", "fonts/arvo-regular-webfont");
52
+ /// @example css - Result
53
+ /// @font-face {
54
+ /// font-family: "Arvo";
55
+ /// font-weight: normal;
56
+ /// font-style: normal;
57
+ /// src: url('fonts/arvo-regular-webfont.eot');
58
+ /// src: url('fonts/arvo-regular-webfont.eot?#iefix') format('embedded-opentype'),
59
+ /// url('fonts/arvo-regular-webfont.woff2') format('woff2'),
60
+ /// url('fonts/arvo-regular-webfont.woff') format('woff'),
61
+ /// url('fonts/arvo-regular-webfont.ttf') format('truetype'),
62
+ /// url('fonts/arvo-regular-webfont.svg#svgFontName') format('svg');
63
+ /// }
64
+
65
+ @mixin font-face ($font-family, $file-path, $weight: normal, $style: normal, $formats: eot woff2 woff ttf svg) {
66
+ @if index('italic' 'oblique', $weight) {
67
+ $style: $weight;
68
+ $weight: normal;
69
+ }
70
+
71
+ @font-face {
72
+ font-family: $font-family;
73
+ font-weight: $weight;
74
+ font-style: $style;
75
+
76
+ @if index($formats, eot) {
77
+ src: url('#{$file-path}.eot');
78
+ }
79
+ src: font-src($formats, $file-path, $font-family);
80
+ }
81
+ }
82
+
83
+ /// Mixin helper to indent first line of paragraphe text
84
+ /// @param {Length} $indent [1.5em] - Indentation size
85
+ /// @example scss - Usage
86
+ /// .foo {
87
+ /// @include indent-text();
88
+ /// }
89
+ /// @example css - Result
90
+ /// .foo {
91
+ /// margin: 0;
92
+ /// text-indent: 1.5em;
93
+ /// }
94
+
95
+ @mixin indent-text ($indent: 1.5em) {
96
+ p {
97
+ margin: 0;
98
+ text-indent: $indent;
99
+ }
100
+ }
101
+
102
+ /// Mixin helper to replace underline of link with border-bottom
103
+ /// @param {Color} $color [inherit] - color of border
104
+ /// @param {string} $style [solid] - style of border
105
+ /// @param {Length} $width [1px] - size of border
106
+ /// @example scss - Usage
107
+ /// .foo {
108
+ /// @include link-replace-underline(red, dotted);
109
+ /// }
110
+ /// @example css - Result
111
+ /// .foo {
112
+ /// text-decoration: none;
113
+ /// border-bottom-width: 1px;
114
+ /// border-bottom-style: dotted;
115
+ /// border-bottom-color: red;
116
+ /// }
117
+
118
+ @mixin link-replace-underline ($color: inherit, $style: solid, $width: 1px) {
119
+ text-decoration: none;
120
+ border-bottom-width: $width;
121
+ border-bottom-style: $style;
122
+ @if $color != inherit {
123
+ border-bottom-color: $color;
124
+ }
125
+ }
126
+
127
+ /// Mixin helper to add side line arround text
128
+ /// @param {Length} $height [1px] - height of side lines
129
+ /// @param {Length} $space [0.5em] - space around text
130
+ /// @param {Color} $color [inherit] - color of side lines
131
+ /// @param {string} $style [solid] - styles of side lines
132
+ /// @param {Length} $v-adjust [false] - adjust verticality
133
+ /// @param {Length} $double [false] - size between 2 lines in same side
134
+ /// @example scss - Usage
135
+ /// .foo {
136
+ /// @include side-lined(5px, $color: red, $double: 0.3em);
137
+ /// }
138
+ /// @example css - Result
139
+ /// .foo {
140
+ /// display: block;
141
+ /// overflow: hidden;
142
+ /// text-align: center;
143
+ /// }
144
+ /// .foo:before,
145
+ /// .foo:after {
146
+ /// content: "";
147
+ /// display: inline-block;
148
+ /// vertical-align: middle;
149
+ /// position: relative;
150
+ /// width: 50%;
151
+ /// border-top-style: solid;
152
+ /// border-top-width: 5px;
153
+ /// border-top-color: red;
154
+ /// height: 0.3em;
155
+ /// border-bottom-style: solid;
156
+ /// border-bottom-width: 5px;
157
+ /// border-bottom-color: $color;
158
+ /// }
159
+
160
+ @mixin side-lined ($height: 1px, $space: 0.5em, $color: inherit, $style: solid, $v-adjust: false, $double: false) {
161
+ display: block;
162
+ overflow: hidden;
163
+ text-align: center;
164
+
165
+ &:before,
166
+ &:after {
167
+ content: "";
168
+ display: inline-block;
169
+ vertical-align: middle;
170
+ position: relative;
171
+ width: 50%;
172
+
173
+ border-top-style: $style;
174
+ border-top-width: $height;
175
+
176
+ @if $color != inherit {
177
+ border-top-color: $color;
178
+ }
179
+
180
+ @if $v-adjust != false {
181
+ bottom: $v-adjust;
182
+ }
183
+
184
+ @if $double != false {
185
+ height: $double;
186
+ border-bottom-style: $style;
187
+ border-bottom-width: $height;
188
+ @if $color != inherit {
189
+ border-bottom-color: $color;
190
+ }
191
+ }
192
+ }
193
+
194
+ &:before {
195
+ right: $space;
196
+ margin-left: -50%;
197
+ }
198
+ &:after {
199
+ left: $space;
200
+ margin-right: -50%;
201
+ }
202
+ }
203
+
204
+ /// Mixin helper to truncate text
205
+ /// @param {Length} $truncation-boundary - Max size of your container
206
+ /// @example scss - Usage
207
+ /// .foo {
208
+ /// @include truncate(100%);
209
+ /// }
210
+ /// @example css - Result
211
+ /// .foo {
212
+ /// max-width: 100%;
213
+ /// white-space: nowrap;
214
+ /// overflow: hidden;
215
+ /// text-overflow: ellipsis;
216
+ /// }
217
+
218
+ @mixin truncate {
219
+ white-space: nowrap;
220
+ overflow: hidden;
221
+ text-overflow: ellipsis;
222
+ }
223
+
224
+ /// Mixin helper to get action selector
225
+ /// @param {Boolean} $active [false] - add active selector
226
+ /// @example scss - Usage
227
+ /// .foo {
228
+ /// @include selected {
229
+ /// background-color: red;
230
+ /// }
231
+ /// }
232
+ /// @example css - Result
233
+ /// .foo:hover,
234
+ /// .foo:focus{
235
+ /// background-color: red;
236
+ /// }
237
+
238
+ @mixin selected ($active: false) {
239
+ @if $active {
240
+ &:hover,
241
+ &.hover,
242
+ &:focus,
243
+ &.focus,
244
+ &:active,
245
+ &.active {
246
+ @content;
247
+ }
248
+ }
249
+ @else {
250
+ &:hover,
251
+ &.hover,
252
+ &:focus,
253
+ &.focus {
254
+ @content;
255
+ }
256
+ }
257
+ }
258
+
259
+ /// Mixin helper to hide text
260
+ /// @param {Boolean} $break [false] - set to true to break element
261
+ /// @param {Length} $indent [200%] - indentation text
262
+ /// @param {String} $align [left] - text alignement
263
+ /// @param {String} $overflow [hidden] - overflow of element
264
+ /// @example scss - Usage
265
+ /// .foo {
266
+ /// @include hide-text;
267
+ /// }
268
+ /// @example css - Result
269
+ /// .foo{
270
+ /// text-indent: $indent;
271
+ /// text-align: $align;
272
+ /// font-size: 0;
273
+ /// white-space: nowrap;
274
+ /// overflow: $overflow;
275
+ /// }
276
+
277
+ @mixin hide-text($break: false, $indent: 200%, $align: left, $overflow: hidden) {
278
+ @if $break {
279
+ position: absolute;
280
+ top: 0; left: 0;
281
+ pointer-events: none;
282
+ }
283
+ text-indent: $indent;
284
+ text-align: $align;
285
+ font-size: 0;
286
+ white-space: nowrap;
287
+ @if $overflow {
288
+ overflow: $overflow;
289
+ }
290
+ }
291
+
292
+ /// Mixin helper to replace text with image
293
+ /// @param {Length} $w - width of element
294
+ /// @param {Length} $h - height of element
295
+ /// @param {String} $file - file path
296
+ /// @param {String} $overflow [hidden] - overflow of element
297
+ /// @example scss - Usage
298
+ /// .foo {
299
+ /// @include hide-text;
300
+ /// }
301
+ /// @example css - Result
302
+ /// .foo{
303
+ /// text-indent: $indent;
304
+ /// text-align: $align;
305
+ /// font-size: 0;
306
+ /// white-space: nowrap;
307
+ /// overflow: $overflow;
308
+ /// }
309
+
310
+ @mixin text-replacement($w, $h, $file, $overflow: hidden) {
311
+ @include responsive-ratio($w, $h, true);
312
+ position: relative;
313
+ max-width: $w * 1px;
314
+ background: url($file) 50% 50% no-repeat;
315
+ background-size: contain;
316
+ @include hide-text($overflow: $overflow);
317
+ }
318
+
319
+ /// Mixin helper to color text
320
+ /// @param {Color} $color - color of your text
321
+ /// @example scss - Usage
322
+ /// .foo {
323
+ /// @include text-emphasis-variant(#c51c1c)
324
+ /// }
325
+ /// @example css - Result
326
+ /// .foo{
327
+ /// color: #c51c1c;
328
+ /// }
329
+ ///
330
+ /// .foo a{
331
+ /// text-decoration: none;
332
+ /// border-bottom-width: 1px;
333
+ /// border-bottom-style: dotted;
334
+ /// border-bottom-color: red;
335
+ /// }
336
+ ///
337
+ /// .foo a:hover{
338
+ /// color: #941515;
339
+ /// }
340
+
341
+ @mixin text-emphasis-variant($color) {
342
+ color: $color;
343
+
344
+ a{
345
+ @include link-replace-underline;
346
+
347
+ &:hover {
348
+ color: darken($color, 20%);
349
+ }
350
+ }
351
+ }
352
+
353
+ /// Mixin helper to replace text with image
354
+ /// @param {Length} $w - width of element
355
+ /// @param {Length} $h - height of element
356
+ /// @param {String} $file - file path
357
+ /// @param {String} $overflow [hidden] - overflow of element
358
+ /// @example scss - Usage
359
+ /// .foo {
360
+ /// @include hide-text;
361
+ /// }
362
+ /// @example css - Result
363
+ /// .foo{
364
+ /// text-indent: $indent;
365
+ /// text-align: $align;
366
+ /// font-size: 0;
367
+ /// white-space: nowrap;
368
+ /// overflow: $overflow;
369
+ /// }
370
+
371
+ @mixin lead($font-size) {
372
+ margin-bottom: $line-height-computed;
373
+ @include font-size($font-size);
374
+ @include line-height($font-size);
375
+ font-weight: 300;
371
376
  }