Skip to content

Commit 0fbafe7

Browse files
committed
fix: use multiplications directly instead of math.div, quiet deprecation warnings
1 parent ea26362 commit 0fbafe7

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

scripts/build-css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ mkdir -p "$DIST_DIR"
1414

1515
# ./dist/cdn/docs-searchbar.css
1616
echo "$LICENSE" > "$DIST_FILE";
17-
sass --style expanded ./src/styles/main.scss \
17+
sass --style expanded --quiet-deps ./src/styles/main.scss \
1818
| postcss --use autoprefixer -o "$DIST_FILE"
1919

2020
# copy styles

src/styles/_dropdown.scss

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// Detect lightness
2-
@use "sass:math";
3-
42
@function detectLightness($color) {
53
@if (lightness($color) > 60) {
64
@return mix($color, #000, 90%);
@@ -264,7 +262,7 @@
264262
display: block;
265263
width: 70%;
266264
position: relative;
267-
padding: math.div($padding, 3) 0 math.div($padding, 3) math.div($padding, 1.5);
265+
padding: $padding*0.3333333333 0 $padding*0.3333333333 $padding*0.6666666667;
268266
cursor: pointer;
269267

270268
&:before {
@@ -304,7 +302,7 @@
304302
padding-left: 0;
305303
text-align: right;
306304
position: relative;
307-
padding: math.div($padding, 3) math.div($padding, 1.5);
305+
padding: $padding*0.3333333333 $padding*0.6666666667;
308306
color: $subtitle-color;
309307
font-size: $subtitle-size;
310308
word-wrap: break-word;
@@ -500,7 +498,7 @@
500498
margin: $padding*0.25 0 0;
501499
display: desc($include-desc);
502500
line-height: 1.4em;
503-
padding: math.div($padding, 3) $padding*0.5;
501+
padding: $padding*0.3333333333 $padding*0.5;
504502
background: $suggestion-background-color;
505503
font-size: $text-size;
506504
opacity: 0.8;
@@ -522,7 +520,7 @@
522520
width: 180px;
523521
height: 20px;
524522
z-index: 2000;
525-
margin-top: math.div($padding, 1.5);
523+
margin-top: $padding*0.6666666667;
526524
color: $text-color;
527525
margin-left: auto;
528526
}

src/styles/_searchbox.scss

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
@use "sass:math";
2-
31
@function even-px($value) {
42
@if type-of($value) == 'number' {
53
@if (unitless($value)) {
64
$value: $value * 1px;
75
} @else if unit($value) == 'em' {
8-
$value: (math.div($value, 1em) * 16px);
6+
$value: ($value / 1em * 16px);
97
} @else if unit($value) == 'pts' {
108
$value: $value * 1.3333 * 1px;
119
} @else if unit($value) == '%' {
12-
$value: math.div($value * 16, 100%) * 1px;
10+
$value: $value * 16 / 100% * 1px;
1311
}
1412
$value: round($value);
1513
@if ($value % 2 != 0px) {
@@ -32,13 +30,13 @@
3230
$input-focus-background: #fff,
3331
$placeholder-color: #aaa,
3432
$icon: 'sbx-icon-search-1',
35-
$icon-size: math.div($input-height, 1.6),
33+
$icon-size: $input-height*0.625,
3634
$icon-position: left,
3735
$icon-color: #888,
3836
$icon-background: $input-focus-border-color,
3937
$icon-background-opacity: 0.1,
4038
$icon-clear: 'sbx-icon-clear-1',
41-
$icon-clear-size: math.div($font-size, 1.1),
39+
$icon-clear-size: $font-size*0.91,
4240
$dark-mode: false
4341
) {
4442
.searchbox {

0 commit comments

Comments
 (0)