2020-07-23 11:22:57 +02:00
|
|
|
@import "colors";
|
|
|
|
@import "constants";
|
|
|
|
|
|
|
|
// Toggle-switch
|
|
|
|
// The switch - the box around
|
|
|
|
.form label.toggle-switch {
|
|
|
|
position: relative;
|
|
|
|
display: inline-block;
|
|
|
|
height: 24px;
|
|
|
|
margin: 0;
|
2020-07-24 12:02:40 +02:00
|
|
|
margin-right: 15px;
|
2023-02-28 16:33:22 +01:00
|
|
|
|
|
|
|
margin-bottom: $default-fields-spacer;
|
|
|
|
|
|
|
|
&.small-margin {
|
|
|
|
margin-bottom: $default-spacer;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.no-margin {
|
|
|
|
margin-bottom: 0;
|
|
|
|
}
|
2020-07-23 11:22:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Hide default HTML checkbox
|
|
|
|
.form label.toggle-switch input[type="checkbox"] {
|
|
|
|
opacity: 0;
|
|
|
|
width: 0;
|
|
|
|
height: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The control
|
|
|
|
.toggle-switch-control {
|
|
|
|
position: absolute;
|
|
|
|
width: 47px;
|
|
|
|
cursor: pointer;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
background-color: $border-grey;
|
|
|
|
transition: 0.4s;
|
2020-07-24 12:02:40 +02:00
|
|
|
border: 1px solid transparent;
|
2020-07-23 11:22:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-control::before {
|
|
|
|
position: absolute;
|
|
|
|
content: "";
|
|
|
|
height: 20px;
|
|
|
|
width: 20px;
|
2020-07-24 12:02:40 +02:00
|
|
|
left: 1px;
|
|
|
|
bottom: 1px;
|
2020-07-23 11:22:57 +02:00
|
|
|
background-color: $white;
|
|
|
|
transition: 0.4s;
|
|
|
|
}
|
|
|
|
|
|
|
|
input:checked + .toggle-switch-control {
|
|
|
|
background-color: $green;
|
|
|
|
}
|
|
|
|
|
|
|
|
input:focus + .toggle-switch-control {
|
2021-09-20 15:04:24 +02:00
|
|
|
border-color: $blue-france-500;
|
|
|
|
box-shadow: 0px 0px 2px 1px $blue-france-500;
|
2020-07-23 11:22:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
input:checked + .toggle-switch-control::before {
|
|
|
|
transform: translateX(23px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-label {
|
|
|
|
margin-left: 47px;
|
2020-07-24 12:02:40 +02:00
|
|
|
font-size: 16px;
|
2020-07-23 11:22:57 +02:00
|
|
|
font-weight: normal;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-label.on {
|
|
|
|
color: $green;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-label.off {
|
|
|
|
color: $grey;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-checkbox:checked ~ .toggle-switch-label.off {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-checkbox:not(:checked) ~ .toggle-switch-label.on {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Rounded control
|
|
|
|
.toggle-switch-control.round {
|
|
|
|
border-radius: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toggle-switch-control.round::before {
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|