mirror of
https://github.com/HSLdevcom/digitransit-ui
synced 2025-07-05 16:30:37 +02:00

Also: - Move generic Toggle to componentfolder root - Remove dead styles - Refactor some componets
99 lines
1.7 KiB
SCSS
99 lines
1.7 KiB
SCSS
.option-toggle-container {
|
|
align-self: center;
|
|
|
|
label {
|
|
height: 20px;
|
|
width: 20px;
|
|
cursor: pointer;
|
|
position: absolute;
|
|
left: 0;
|
|
top: 3px;
|
|
|
|
&.checked {
|
|
border: $primary-color 1px solid;
|
|
|
|
&::before {
|
|
color: $primary-color;
|
|
font-family: $font-family;
|
|
font-size: 1.25em;
|
|
font-weight: $font-weight-medium;
|
|
line-height: 1;
|
|
margin-left: 0.1em;
|
|
margin-top: 0.2em;
|
|
transform: rotateY(15deg);
|
|
}
|
|
}
|
|
}
|
|
|
|
> span {
|
|
font-weight: $font-weight-book;
|
|
user-select: none;
|
|
margin-top: 0.75em;
|
|
}
|
|
|
|
/* Box around the slider */
|
|
.toggle {
|
|
position: relative;
|
|
display: inline-block;
|
|
width: 51px;
|
|
height: 31px;
|
|
}
|
|
|
|
/* Hide default HTML checkbox */
|
|
.toggle input {
|
|
opacity: 0;
|
|
width: 0;
|
|
height: 0;
|
|
}
|
|
|
|
/* The slider */
|
|
.slider {
|
|
position: absolute;
|
|
cursor: pointer;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: #ccc;
|
|
transition: 0.4s;
|
|
}
|
|
|
|
.slider::before {
|
|
position: absolute;
|
|
content: '';
|
|
height: 26px;
|
|
width: 26px;
|
|
left: 0;
|
|
bottom: 0;
|
|
background-color: white;
|
|
transition: 0.4s;
|
|
}
|
|
|
|
input:checked + .slider {
|
|
background-color: $primary-color;
|
|
}
|
|
|
|
input:focus-visible + .slider {
|
|
box-shadow: 0 0 0 2px black;
|
|
}
|
|
|
|
input:checked + .slider::before {
|
|
transform: translateX(20px);
|
|
border: none;
|
|
}
|
|
|
|
/* Rounded sliders */
|
|
.slider.round {
|
|
border-radius: 34px;
|
|
background: white;
|
|
border: 1px solid #888;
|
|
}
|
|
|
|
.slider.round::before {
|
|
border-radius: 50%;
|
|
width: 29px;
|
|
height: 29px;
|
|
border: solid 0.5px #888;
|
|
background-color: #fff;
|
|
}
|
|
}
|