2020-06-15 14:56:05 +00:00
|
|
|
@import "../../../css/static/properties";
|
|
|
|
@import "../../../css/static/mixin";
|
|
|
|
|
2020-07-20 17:08:13 +00:00
|
|
|
html:root {
|
|
|
|
--switch-background: #1c1c1c;
|
|
|
|
|
|
|
|
--switch-thumb-background: #3d3a3a;
|
|
|
|
--switch-thumb-shadow: rgba(0, 0, 0, 0.27);
|
|
|
|
|
|
|
|
--switch-dot-background: #a5a5a5;
|
|
|
|
--switch-dot-shadow: rgba(165, 165, 165, 0.4);
|
|
|
|
|
|
|
|
--switch-dot-checked-background: #46c0ec;
|
|
|
|
--switch-dot-checked-shadow: #46c0ec;
|
|
|
|
|
|
|
|
--switch-thumb-disabled-background: #252424;
|
|
|
|
--switch-thumb-disabled-shadow: #2f2d2d;
|
|
|
|
|
|
|
|
--switch-dot-disabled-background: #808080;
|
|
|
|
--switch-dot-disabled-shadow: rgba(102, 102, 102, 0.4);
|
|
|
|
|
|
|
|
--switch-dot-checked-disabled-background: #138db9;
|
|
|
|
--switch-dot-checked-disabled-shadow: #138db9;
|
|
|
|
}
|
|
|
|
|
2020-06-15 14:56:05 +00:00
|
|
|
/* general switch look */
|
|
|
|
.switch {
|
|
|
|
$ball_outer_width: 1.5em; /* 1.5? */
|
|
|
|
$ball_inner_width: .4em;
|
|
|
|
|
|
|
|
$slider_height: .8em;
|
|
|
|
$slider_width: 2em;
|
|
|
|
|
|
|
|
$slider_border_size: .1em;
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
outline: none;
|
|
|
|
|
|
|
|
width: $slider_width;
|
|
|
|
height: $slider_height;
|
|
|
|
|
|
|
|
/* "allocate" space for the slider */
|
|
|
|
margin-top: ($ball_outer_width - $slider_height) / 2;
|
|
|
|
margin-bottom: ($ball_outer_width - $slider_height) / 2;
|
|
|
|
margin-left: $ball_outer_width / 2;
|
|
|
|
margin-right: $ball_outer_width / 2;
|
|
|
|
|
|
|
|
/* fix size */
|
|
|
|
flex-shrink: 0;
|
|
|
|
flex-grow: 0;
|
|
|
|
|
|
|
|
input {
|
|
|
|
/* "hide" the actual input node */
|
|
|
|
opacity: 0;
|
|
|
|
width: 0;
|
|
|
|
height: 0;
|
|
|
|
outline: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.slider {
|
|
|
|
pointer-events: all!important;
|
|
|
|
position: absolute;
|
|
|
|
cursor: pointer;
|
|
|
|
outline: none;
|
|
|
|
|
|
|
|
top: -$slider_border_size;
|
|
|
|
left: -$slider_border_size;
|
|
|
|
right: -$slider_border_size;
|
|
|
|
bottom: -$slider_border_size;
|
|
|
|
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-background);
|
2020-06-15 14:56:05 +00:00
|
|
|
|
|
|
|
border: $slider_border_size solid #262628;
|
|
|
|
border-radius: 5px;
|
|
|
|
|
|
|
|
&:before {
|
|
|
|
position: absolute;
|
|
|
|
content: "";
|
|
|
|
|
|
|
|
height: $ball_outer_width;
|
|
|
|
width: $ball_outer_width;
|
|
|
|
|
|
|
|
left: - $ball_outer_width / 2;
|
|
|
|
bottom: -($ball_outer_width - $slider_height) / 2;
|
|
|
|
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-thumb-background);
|
2020-06-15 14:56:05 +00:00
|
|
|
|
|
|
|
@include transition(.4s);
|
|
|
|
border-radius: 50%;
|
|
|
|
|
2020-07-20 17:08:13 +00:00
|
|
|
box-shadow: 0 0 .2em 1px var(--switch-thumb-shadow);
|
2020-06-15 14:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.dot {
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
height: $ball_inner_width;
|
|
|
|
width: $ball_inner_width;
|
|
|
|
|
|
|
|
left: -($ball_inner_width / 2);
|
|
|
|
bottom: $slider_height / 2 - $ball_inner_width / 2;
|
|
|
|
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-dot-background);
|
|
|
|
box-shadow: 0 0 1em 1px var(--switch-dot-shadow);
|
2020-06-15 14:56:05 +00:00
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
@include transition(.4s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input:focus + .slider {
|
|
|
|
}
|
|
|
|
|
|
|
|
input:checked + .slider {
|
|
|
|
&:before {
|
|
|
|
@include transform(translateX($slider_width));
|
|
|
|
}
|
|
|
|
|
|
|
|
.dot {
|
|
|
|
@include transform(translateX($slider_width));
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-dot-checked-background);
|
|
|
|
box-shadow: 0 0 1em 1px var(--switch-dot-checked-shadow);
|
2020-06-15 14:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
|
|
|
|
|
|
.label {
|
|
|
|
margin-left: .25em;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.disabled {
|
|
|
|
.dot {
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-dot-disabled-background);
|
|
|
|
box-shadow: 0 0 1em 1px var(--switch-dot-disabled-shadow);
|
2020-06-15 14:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input:checked + .slider {
|
|
|
|
.dot {
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-dot-checked-disabled-background);
|
|
|
|
box-shadow: 0 0 1em 1px var(--switch-dot-checked-disabled-shadow);
|
2020-06-15 14:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.slider {
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-thumb-disabled-background);
|
2020-06-15 14:56:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.slider:before {
|
2020-07-20 17:08:13 +00:00
|
|
|
background-color: var(--switch-thumb-disabled-shadow);
|
2020-06-15 14:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|