Skip to content

Commit d785ae2

Browse files
adjusted input range css (certego#87)
1 parent 5fa0333 commit d785ae2

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

src/styles/_form.scss

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,54 @@ textarea {
3030
/* Weight range slider */
3131

3232
input[type="range"] {
33+
&.color-range-slider {
34+
-webkit-appearance: none;
35+
appearance: none;
36+
border: none;
37+
border-radius: 4px;
38+
height: 5px;
39+
background: linear-gradient(
40+
to right,
41+
var(--slider-fill-color, $range-fill-color),
42+
var(--slider-fill-color, $range-fill-color)
43+
var(--fill-percentage, $range-fill-percentage),
44+
grey var(--fill-percentage, $range-fill-percentage),
45+
grey
46+
);
47+
}
3348
// Chrome
3449
&::-webkit-slider-runnable-track {
50+
-webkit-appearance: none;
3551
overflow: hidden;
36-
height: 5px;
37-
background-color: $light;
52+
height: 12px;
53+
background: transparent;
54+
border: none;
3855
}
3956
&::-webkit-slider-thumb {
57+
-webkit-appearance: none;
4058
cursor: ew-resize;
4159
height: 12px;
4260
width: 12px;
43-
border-radius: 0;
44-
background-color: shade-color($info, 30%);
45-
box-shadow: -80px 0 0 80px $sev-medium;
61+
border-radius: 50%;
62+
background: var(--slider-fill-color, $range-fill-color);
63+
box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
64+
margin-top: 0px;
4665
}
4766

4867
// Firefox
4968
&::-moz-range-progress {
50-
background: linear-gradient(
51-
to right,
52-
$sev-very-low 0%,
53-
$sev-medium 20%,
54-
$sev-critical 90%
55-
);
69+
background: var(--slider-fill-color, $range-fill-color);
5670
}
5771
&::-moz-range-track {
5872
height: 2.5px;
59-
background-color: $light;
73+
background-color: grey;
74+
border-radius: 4px;
6075
}
6176
&::-moz-range-thumb {
6277
cursor: ew-resize;
6378
height: 12px;
6479
width: 12px;
65-
background-color: shade-color($info, 30%);
66-
border-radius: 0;
80+
border-radius: 50%;
81+
background: var(--slider-fill-color, $range-fill-color);
6782
}
6883
}

src/styles/_variables.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ $custom-range-thumb-box-shadow: 0 0.1rem 0.25rem rgba(#fff, 0.1);
199199

200200
$custom-file-button-bg: $dark;
201201

202+
$range-fill-color: $info;
203+
$range-fill-percentage: 0%;
204+
202205
// button
203206
$btn-font-weight: 600;
204207
$btn-box-shadow: none;

0 commit comments

Comments
 (0)