117 lines
2.4 KiB
SCSS
117 lines
2.4 KiB
SCSS
.pure-material-switch {
|
|
z-index: 0;
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
|
|
.pure-material-switch > input {
|
|
appearance: none;
|
|
-moz-appearance: none;
|
|
-webkit-appearance: none;
|
|
z-index: -1;
|
|
position: absolute;
|
|
right: 6px;
|
|
top: -8px;
|
|
display: block;
|
|
margin: 0;
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
background-color: rgba($black, 0.38);
|
|
outline: none;
|
|
opacity: 0;
|
|
transform: scale(1);
|
|
pointer-events: none;
|
|
transition: opacity 0.3s 0.1s, transform 0.2s 0.1s;
|
|
}
|
|
|
|
.pure-material-switch > span {
|
|
display: inline-block;
|
|
width: 100%;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.pure-material-switch > span::before {
|
|
content: "";
|
|
float: right;
|
|
display: inline-block;
|
|
margin: 5px 0 5px 10px;
|
|
border-radius: 7px;
|
|
width: 36px;
|
|
height: 14px;
|
|
background-color: rgba($black, 0.38);
|
|
vertical-align: top;
|
|
transition: background-color 0.2s, opacity 0.2s;
|
|
}
|
|
|
|
.pure-material-switch > span::after {
|
|
content: "";
|
|
position: absolute;
|
|
top: 2px;
|
|
right: 16px;
|
|
border-radius: 50%;
|
|
width: 20px;
|
|
height: 20px;
|
|
background-color: $white;
|
|
box-shadow: 0 3px 1px -2px rgba($black, 0.2), 0 2px 2px 0 rgba($black, 0.14), 0 1px 5px 0 rgba($black, 0.12);
|
|
transition: background-color 0.2s, transform 0.2s;
|
|
}
|
|
|
|
.pure-material-switch > input:checked {
|
|
right: -10px;
|
|
background-color: $limeGreen;
|
|
}
|
|
|
|
.pure-material-switch > input:checked + span::before {
|
|
background-color: rgba($limeGreen, 0.6);
|
|
}
|
|
|
|
.pure-material-switch > input:checked + span::after {
|
|
background-color: $limeGreen;
|
|
transform: translateX(16px);
|
|
}
|
|
|
|
.pure-material-switch:hover > input {
|
|
opacity: 0.04;
|
|
}
|
|
|
|
.pure-material-switch > input:focus {
|
|
opacity: 0.12;
|
|
}
|
|
|
|
.pure-material-switch:hover > input:focus {
|
|
opacity: 0.16;
|
|
}
|
|
|
|
.pure-material-switch > input:active {
|
|
opacity: 1;
|
|
transform: scale(0);
|
|
transition: transform 0s, opacity 0s;
|
|
}
|
|
|
|
.pure-material-switch > input:active + span::before {
|
|
background-color: rgba($limeGreen, 0.6);
|
|
}
|
|
|
|
.pure-material-switch > input:checked:active + span::before {
|
|
background-color: rgba($black, 0.38);
|
|
}
|
|
|
|
.pure-material-switch > input:disabled {
|
|
opacity: 0;
|
|
}
|
|
|
|
.pure-material-switch > input:disabled + span {
|
|
color: $black;
|
|
opacity: 0.38;
|
|
cursor: default;
|
|
}
|
|
|
|
.pure-material-switch > input:disabled + span::before {
|
|
background-color: rgba($black, 0.38);
|
|
}
|
|
|
|
.pure-material-switch > input:checked:disabled + span::before {
|
|
background-color: rgba($limeGreen, 0.6);
|
|
}
|