-
Notifications
You must be signed in to change notification settings - Fork 3
/
_mixins.scss
112 lines (98 loc) · 2.34 KB
/
_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
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
@mixin respond-from($min) {
@media (min-width: $min) {
@content;
}
}
@mixin respond-until($max) {
@media (max-width: $max - 1) {
@content;
}
}
@mixin respond-between($min, $max) {
@media (min-width: $min) and (max-width: $max - 1) {
@content;
}
}
@mixin wh($width, $height: none) {
width: $width;
@if($height == none) {
height: $width;
} @else {
height: $height;
}
}
@mixin pos($coords...) {
@if length($coords) == 1 {
// All positions get the same value
top: nth($coords, 1);
right: nth($coords, 1);
bottom: nth($coords,1);
left: nth($coords, 1);
} @else if length($coords) == 2 {
// Only give left/top (x,y)
left: nth($coords, 1);
top: nth($coords, 2);
} @else {
// Give positions in top-right-bottom-left order
top: nth($coords, 1);
right: nth($coords, 2);
bottom: nth($coords, 3);
left: nth($coords, 4);
}
}
@mixin clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
@mixin background-center($size: cover) {
background-size: $size;
background-repeat: no-repeat;
background-position: center center;
}
@mixin transform-center-horizontal {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
@mixin transform-center-vertical {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
@mixin transform-center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@mixin flex-center($direction: column) {
display: flex;
align-items: center;
justify-content: center;
flex-direction: $direction;
}
@mixin margin-center {
margin-left: auto;
margin-right: auto;
}
@mixin child-margins($spacing: $valenski-base-unit) {
> * + * {
margin-top: $spacing;
}
}
// From Bootstrap 4:
// https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
@mixin sr-only {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important; // Fix for https://github.com/twbs/bootstrap/issues/25686
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
}