blog/_sass/misc/theme-toggle.scss
2020-12-09 09:53:43 +08:00

80 lines
1.3 KiB
SCSS

.theme-toggle {
position: relative;
width: $base-font-size * 7.65;
margin-top: 10px;
margin-right: 60px;
margin-left: auto;
transition: .3s cubic-bezier(.4,.03,0,1);
label, .toggle {
border-radius: 100px;
}
label {
display: block;
background-color: rgba(120,120,120,.15);
cursor: pointer;
}
.toggle {
position: absolute;
width: 50%;
height: 100%;
background-color: #fff;
box-shadow: 0 2px 15px rgba(0,0,0,.15);
transition: transform .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.names {
font-size: 1em;
font-weight: bolder;
width: 76%;
margin-left: 12%;
position: relative;
display: flex;
justify-content: space-between;
user-select: none;
}
.dark {
opacity: .5;
}
p {
color: #acacac;
margin-bottom: 0;
line-height: 24px;
}
[type="checkbox"] {
display: none;
}
/* Toggle */
[type="checkbox"]:checked ~ label .toggle {
transform: translateX(100%);
background-color: #34323D;
}
[type="checkbox"]:checked ~ label .dark{
opacity: 1;
}
[type="checkbox"]:checked ~ label .light{
opacity: .5;
}
@include media-query(1024px) {
margin-right: 35px;
}
@include media-query($on-palm) {
width: $base-font-size * 6.65;
margin-right: 20px;
.names {
font-size: .85em;
}
}
}