162 lines
3.5 KiB
SCSS
162 lines
3.5 KiB
SCSS
.RangeInput {
|
|
$range-input-handle-color: $ic-brand-primary;
|
|
$range-input-handle-color-hover: darken($ic-brand-primary, 10%);
|
|
|
|
$range-input-handle-border-color-focused: darken($ic-brand-primary, 50%);
|
|
$range-input-handle-size: 20px;
|
|
$range-input-handle-shadow: 0 3px 6px rgba(black, 0.3);
|
|
|
|
$range-input-slider-color: $ic-color-neutral;
|
|
$range-input-value-bg-color: $ic-color-dark;
|
|
$range-input-value-text-color: $ic-color-light;
|
|
$range-input-label-color: $ic-color-dark;
|
|
$range-input-label-font-size: $h2-font-size;
|
|
|
|
@mixin range-input-handle-selector() {
|
|
&::-webkit-slider-thumb {
|
|
@content;
|
|
}
|
|
&::-ms-thumb {
|
|
@content;
|
|
}
|
|
&::-moz-range-thumb {
|
|
@content;
|
|
}
|
|
}
|
|
|
|
@mixin range-input-track-selector() {
|
|
&::-webkit-slider-runnable-track {
|
|
@content;
|
|
}
|
|
&::-moz-range-track {
|
|
@content;
|
|
}
|
|
&::-ms-track {
|
|
@content;
|
|
}
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
width: 100%;
|
|
|
|
// Style range input
|
|
input[type=range] {
|
|
-webkit-appearance: none;
|
|
width: 100%; // for Firefox
|
|
outline: none;
|
|
margin: 0; padding: 0; // for IE
|
|
|
|
// Slider Handle/Thumb
|
|
@include range-input-handle-selector {
|
|
-webkit-appearance: none;
|
|
width: $range-input-handle-size;
|
|
height: $range-input-handle-size;
|
|
border-radius: 50%;
|
|
background: $range-input-handle-color;
|
|
box-shadow: $range-input-handle-shadow;
|
|
cursor: pointer;
|
|
transition: all .15s ease-in-out;
|
|
|
|
&:hover {
|
|
background: $range-input-handle-color-hover;
|
|
}
|
|
}
|
|
|
|
&::-webkit-slider-thumb {
|
|
margin-top: -$range-input-handle-size/4;
|
|
}
|
|
|
|
&:focus,
|
|
&:active {
|
|
outline: none;
|
|
@include range-input-handle-selector {
|
|
box-shadow: $range-input-handle-shadow,
|
|
0 0 0 $range-input-handle-size/2 rgba($range-input-handle-color, .15);
|
|
}
|
|
}
|
|
|
|
// remove outline in FF
|
|
&::-moz-focus-inner,
|
|
&::-moz-focus-outer {
|
|
border: 0;
|
|
outline: none;
|
|
}
|
|
|
|
@include range-input-track-selector {
|
|
height: $range-input-handle-size/2;
|
|
border-radius: 5px;
|
|
background: $range-input-slider-color;
|
|
border-color: transparent;
|
|
color: transparent;
|
|
cursor: pointer;
|
|
animate: 0.2s;
|
|
}
|
|
|
|
&::-ms-track {
|
|
background: transparent;
|
|
border-width: $range-input-handle-size 0;
|
|
}
|
|
&::-ms-fill-upper,
|
|
&::-ms-fill-lower {
|
|
background: $range-input-slider-color;
|
|
|
|
border-radius: $range-input-handle-size/2;
|
|
}
|
|
|
|
&::-ms-tooltip {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
// Label text
|
|
.RangeInput__label {
|
|
margin: 0 0 $ic-sp/2;
|
|
display: block;
|
|
line-height: 1.3;
|
|
font-size: $range-input-label-font-size;
|
|
color: $range-input-label-color;
|
|
}
|
|
|
|
// Slider + Tooltip
|
|
.RangeInput__control {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
// Slider
|
|
.RangeInput__input {
|
|
flex: auto;
|
|
}
|
|
|
|
// Tooltip/Selected Value
|
|
.RangeInput__value {
|
|
display: inline-block;
|
|
position: relative;
|
|
width: 70px;
|
|
color: $range-input-value-text-color;
|
|
font-size: 16px;
|
|
line-height: 20px;
|
|
text-align: center;
|
|
border-radius: 3px;
|
|
background: $range-input-value-bg-color;
|
|
padding: 5px 10px;
|
|
margin-left: 7px;
|
|
|
|
&:after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 8px;
|
|
left: -6px;
|
|
width: 0;
|
|
height: 0;
|
|
border-top: 7px solid transparent;
|
|
border-right: 7px solid $range-input-value-bg-color;
|
|
border-bottom: 7px solid transparent;
|
|
}
|
|
}
|
|
}
|