|
7 | 7 |
|
8 | 8 | // Media queries
|
9 | 9 | @mixin media-query($queries...) {
|
10 |
| - @each $query in $queries { |
11 |
| - @each $breakpoint in variables.$breakpoints { |
12 |
| - $name: list.nth($breakpoint, 1); |
13 |
| - $declaration: list.nth($breakpoint, 2); |
14 |
| - |
15 |
| - @if $query == $name and $declaration { |
16 |
| - @media only screen and #{$declaration} { |
17 |
| - @content; |
18 |
| - } |
19 |
| - } |
| 10 | + @each $query in $queries { |
| 11 | + @each $breakpoint in variables.$breakpoints { |
| 12 | + $name: list.nth($breakpoint, 1); |
| 13 | + $declaration: list.nth($breakpoint, 2); |
| 14 | + |
| 15 | + @if $query == $name and $declaration { |
| 16 | + @media only screen and #{$declaration} { |
| 17 | + @content; |
20 | 18 | }
|
| 19 | + } |
21 | 20 | }
|
| 21 | + } |
22 | 22 | }
|
23 | 23 |
|
24 | 24 | // Button mixin
|
25 | 25 | @mixin button($bg, $hover-bg) {
|
26 |
| - padding: 0.5em 2rem; |
27 |
| - font-weight: variables.$weight--bold; |
28 |
| - color: variables.$color--white; |
29 |
| - text-align: center; |
30 |
| - background: $bg; |
31 |
| - border: 1px solid variables.$color--white; |
32 |
| - transition: color, background, border, variables.$transition; |
33 |
| - display: flex; |
34 |
| - align-items: center; |
35 |
| - justify-content: center; |
36 |
| - |
37 |
| - &:hover, |
38 |
| - &:focus, |
39 |
| - &:active { |
40 |
| - cursor: pointer; |
41 |
| - background: $hover-bg; |
42 |
| - } |
| 26 | + padding: 0.5em 2rem; |
| 27 | + font-weight: variables.$weight--bold; |
| 28 | + color: variables.$color--white; |
| 29 | + text-align: center; |
| 30 | + background: $bg; |
| 31 | + border: 1px solid variables.$color--white; |
| 32 | + transition: color, background, border, variables.$transition; |
| 33 | + display: flex; |
| 34 | + align-items: center; |
| 35 | + justify-content: center; |
| 36 | + |
| 37 | + &:hover, |
| 38 | + &:focus, |
| 39 | + &:active { |
| 40 | + cursor: pointer; |
| 41 | + background: $hover-bg; |
| 42 | + } |
43 | 43 | }
|
44 | 44 |
|
45 | 45 | // Narrow button mixin
|
46 | 46 | @mixin button--narrow {
|
47 |
| - padding: 0.25rem 0.75rem; |
48 |
| - font-size: 15px; |
49 |
| - vertical-align: middle; |
| 47 | + padding: 0.25rem 0.75rem; |
| 48 | + font-size: 15px; |
| 49 | + vertical-align: middle; |
50 | 50 |
|
51 |
| - @include media-query(lg) { |
52 |
| - & { |
53 |
| - padding: 0.25rem 0.75rem; |
54 |
| - } |
| 51 | + @include media-query(lg) { |
| 52 | + & { |
| 53 | + padding: 0.25rem 0.75rem; |
55 | 54 | }
|
| 55 | + } |
56 | 56 | }
|
57 | 57 |
|
58 | 58 | // Small button mixin
|
59 | 59 | @mixin button--small {
|
60 |
| - padding: 2px; |
61 |
| - font-size: 12px; |
| 60 | + padding: 2px; |
| 61 | + font-size: 12px; |
62 | 62 |
|
63 |
| - @include media-query(lg) { |
64 |
| - & { |
65 |
| - padding: 3px 5px; |
66 |
| - } |
| 63 | + @include media-query(lg) { |
| 64 | + & { |
| 65 | + padding: 3px 5px; |
67 | 66 | }
|
| 67 | + } |
68 | 68 | }
|
69 | 69 |
|
70 | 70 | // Wide button mixin
|
71 | 71 | @mixin button--wide {
|
72 |
| - @include media-query(lg) { |
73 |
| - & { |
74 |
| - padding: 0.5em 80px; |
75 |
| - } |
| 72 | + @include media-query(lg) { |
| 73 | + & { |
| 74 | + padding: 0.5em 80px; |
76 | 75 | }
|
| 76 | + } |
77 | 77 | }
|
78 | 78 |
|
79 | 79 | // Viewport sized typography mixin that takes a min and max pixel-based value
|
80 | 80 | @mixin responsive-font-sizes($min, $max) {
|
81 |
| - $minbreakpoint: 640; |
82 |
| - $maxbreakpoint: 1280; |
83 |
| - $minsize: functions.strip-unit($min); |
84 |
| - $maxsize: functions.strip-unit($max); |
85 |
| - $minrem: functions.rem($min); |
86 |
| - $maxrem: functions.rem($max); |
87 |
| - $slope: math.div($maxsize - $minsize, $maxbreakpoint - $minbreakpoint); |
88 |
| - $intersection: functions.rem($minsize - $slope * $minbreakpoint); |
89 |
| - |
90 |
| - font-size: clamp($minrem, calc($intersection + $slope * 100vw), $maxrem); |
| 81 | + $minbreakpoint: 640; |
| 82 | + $maxbreakpoint: 1280; |
| 83 | + $minsize: functions.strip-unit($min); |
| 84 | + $maxsize: functions.strip-unit($max); |
| 85 | + $minrem: functions.rem($min); |
| 86 | + $maxrem: functions.rem($max); |
| 87 | + $slope: math.div($maxsize - $minsize, $maxbreakpoint - $minbreakpoint); |
| 88 | + $intersection: functions.rem($minsize - $slope * $minbreakpoint); |
| 89 | + |
| 90 | + font-size: clamp($minrem, calc($intersection + $slope * 100vw), $maxrem); |
91 | 91 | }
|
92 | 92 |
|
93 | 93 | // Triangle mixin
|
94 | 94 | // @param {Direction} $direction - Triangle direction, either `top`, `right`, `bottom` or `left`
|
95 | 95 | // @param {Color} $color [currentcolor] - Triangle color
|
96 | 96 | // @param {Length} $size [1em] - Triangle size
|
97 | 97 | @mixin triangle($direction, $color: currentcolor, $size: 0.33rem) {
|
98 |
| - @if not list.index(top right bottom left, $direction) { |
99 |
| - @error 'Direction must be either `top`, `right`, `bottom` or `left`.'; |
100 |
| - } |
| 98 | + @if not list.index(top right bottom left, $direction) { |
| 99 | + @error 'Direction must be either `top`, `right`, `bottom` or `left`.'; |
| 100 | + } |
| 101 | + |
| 102 | + width: 0; |
| 103 | + height: 0; |
| 104 | + content: ""; |
| 105 | + border-#{functions.opposite-direction($direction)}: ($size * 1.5) solid |
| 106 | + $color; |
| 107 | + |
| 108 | + $perpendicular-borders: $size solid transparent; |
| 109 | + |
| 110 | + @if $direction == top or $direction == bottom { |
| 111 | + border-inline-end: $perpendicular-borders; |
| 112 | + border-inline-start: $perpendicular-borders; |
| 113 | + } @else if $direction == right or $direction == left { |
| 114 | + border-block-start: $perpendicular-borders; |
| 115 | + border-block-end: $perpendicular-borders; |
| 116 | + } |
| 117 | +} |
101 | 118 |
|
102 |
| - width: 0; |
103 |
| - height: 0; |
104 |
| - content: ""; |
105 |
| - border-#{functions.opposite-direction($direction)}: ($size * 1.5) solid |
106 |
| - $color; |
| 119 | +@mixin table-ordering-styles { |
| 120 | + thead { |
| 121 | + th { |
| 122 | + // ordering |
| 123 | + &.desc, |
| 124 | + &.asc { |
| 125 | + position: relative; |
| 126 | + color: variables.$color--dark-grey; |
| 127 | + |
| 128 | + &::after { |
| 129 | + position: absolute; |
| 130 | + inset-block-start: 50%; |
| 131 | + margin-inline-start: 3px; |
| 132 | + } |
107 | 133 |
|
108 |
| - $perpendicular-borders: $size solid transparent; |
| 134 | + a { |
| 135 | + color: inherit; |
| 136 | + } |
| 137 | + } |
109 | 138 |
|
110 |
| - @if $direction == top or $direction == bottom { |
111 |
| - border-inline-end: $perpendicular-borders; |
112 |
| - border-inline-start: $perpendicular-borders; |
113 |
| - } @else if $direction == right or $direction == left { |
114 |
| - border-block-start: $perpendicular-borders; |
115 |
| - border-block-end: $perpendicular-borders; |
116 |
| - } |
117 |
| -} |
| 139 | + &.desc { |
| 140 | + &::after { |
| 141 | + @include triangle(top); |
| 142 | + } |
| 143 | + } |
118 | 144 |
|
119 |
| -@mixin table-ordering-styles { |
120 |
| - thead { |
121 |
| - th { |
122 |
| - // ordering |
123 |
| - &.desc, |
124 |
| - &.asc { |
125 |
| - position: relative; |
126 |
| - color: variables.$color--dark-grey; |
127 |
| - |
128 |
| - &::after { |
129 |
| - position: absolute; |
130 |
| - inset-block-start: 50%; |
131 |
| - margin-inline-start: 3px; |
132 |
| - } |
133 |
| - |
134 |
| - a { |
135 |
| - color: inherit; |
136 |
| - } |
137 |
| - } |
138 |
| - |
139 |
| - &.desc { |
140 |
| - &::after { |
141 |
| - @include triangle(top); |
142 |
| - } |
143 |
| - } |
144 |
| - |
145 |
| - &.asc { |
146 |
| - &::after { |
147 |
| - @include triangle(bottom); |
148 |
| - } |
149 |
| - } |
| 145 | + &.asc { |
| 146 | + &::after { |
| 147 | + @include triangle(bottom); |
150 | 148 | }
|
| 149 | + } |
151 | 150 | }
|
| 151 | + } |
152 | 152 | }
|
153 | 153 |
|
154 | 154 | @mixin table-checkbox {
|
155 |
| - input[type="checkbox"] { |
156 |
| - margin: 0 auto; |
157 |
| - display: block; |
158 |
| - width: 1.1rem; |
159 |
| - height: 1.1rem; |
160 |
| - } |
| 155 | + input[type="checkbox"] { |
| 156 | + margin: 0 auto; |
| 157 | + display: block; |
| 158 | + width: 1.1rem; |
| 159 | + height: 1.1rem; |
| 160 | + } |
161 | 161 | }
|
0 commit comments