-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUtils.scss
69 lines (66 loc) · 2.26 KB
/
Utils.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
// Copyright (C) 2020 Really Awesome Technology Ltd
//
// This file is part of RACTF.
//
// RACTF is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// RACTF is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with RACTF. If not, see <https://www.gnu.org/licenses/>.
@function px($size) {
@return ($size / 16) * 1rem;
}
@mixin mapPrimary($bg, $fg) {
background-color: $bg;
border-color: transparent;
color: $fg;
}
@mixin mapPrimaryHover($bg, $fg) {
@include mapPrimary(hover($bg), $fg);
}
@mixin mapPrimaryFocus($bg, $fg) {
@include mapPrimary(focus($bg), $fg);
}
@mixin mapLesser($bg, $fg) {
background-color: transparent;
border-color: $bg;
color: $fg;
}
@mixin mapLesserHover($bg, $fg) {
@include mapPrimaryHover($bg, $fg);
}
@mixin mapLesserFocus($bg, $fg) {
@include mapPrimaryFocus($bg, $fg);
}
@mixin mapTypes($interactive: false, $selector: "", $forceBorder: false, $doLesser: true) {
@each $type in $type-names {
&.#{$type} #{$selector} {
@include mapPrimary(var(--type-#{$type}-bg), var(--type-#{$type}-fg));
@if ($forceBorder) {
border-color: var(--type-#{$type}-bg);
}
}
@if ($doLesser) {
&.#{$type}.lesser #{$selector} {
@include mapLesser(
var(--type-#{$type}-bg-lesser, var(--type-#{$type}-bg)),
var(--type-#{$type}-fg-lesser, var(--type-#{$type}-bg))
);
}
}
@if ($interactive) {
&.#{$type}.lesser:not(.disabled)#{$selector}:hover,
&.#{$type}.lesser:not(.disabled)#{$selector}:focus,
&.#{$type}.lesser:not(.disabled)#{$selector}:active {
@include mapPrimary(var(--type-#{$type}-bg), var(--type-#{$type}-fg));
}
}
}
}