-
Notifications
You must be signed in to change notification settings - Fork 17
/
_form-mixins.scss
51 lines (44 loc) · 1.28 KB
/
_form-mixins.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
// Form mixins - Handles the calculations and abstracted fun
// Font sizing mixin
// @link https://github.com/csswizardry/inuit.css/blob/master/generic/_mixins.scss [props]
// @example
//@include form-font-size(10px);
@mixin form-font-size($font-size) {
font-size: $font-size;
font-size: ($font-size / $form-font-size) * 1rem;
}
// Micro clearfix mixin
// @link http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php [props]
// @example
// @include form-clearfix;
@mixin form-clearfix {
&::after {
clear: both;
content: '';
display: table;
}
}
// Spacing mixin
// @link https://twitter.com/HugoGiraudel [props]
// @example
// @include form-spacing(padding, 0 $form-space auto);
@mixin form-spacing($spacing-type, $args) {
$fallback: ();
$regular: ();
@each $value in $args {
@if type-of($value) == 'number' and unit($value) == 'px' {
$fallback: append($fallback, $value);
$regular: append($regular, $value / $form-font-size * 1rem);
}
@else if type-of($value) == 'number' and unit($value) == 'rem' {
$fallback: append($fallback, $value / 1rem * $form-font-size);
$regular: append($regular, $value);
}
@else {
$fallback: append($fallback, $value);
$regular: append($regular, $value);
}
}
#{$spacing-type}: $fallback;
#{$spacing-type}: $regular;
}