1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-30 21:52:05 +02:00
blog/src/components/molecules/ThemeSwitch.module.scss
2019-11-16 14:06:03 +01:00

82 lines
1.4 KiB
SCSS

@import 'variables';
@import 'mixins';
.themeSwitch {
position: relative;
display: inline-block;
margin-bottom: $spacer * $line-height;
svg {
stroke: $brand-grey-light;
width: $font-size-base;
height: $font-size-base;
margin-top: -0.05rem;
&:last-child {
width: $font-size-base * 0.9;
height: $font-size-base * 0.9;
}
}
}
.checkboxContainer {
display: flex;
align-items: center;
}
$knob-size: 8px;
$knob-space: 1px;
.checkboxFake {
display: block;
position: relative;
width: ($knob-size + ($knob-space * 2)) * 2;
height: $knob-size + ($knob-space * 4);
border: 1px solid $brand-grey-light;
border-radius: 15rem;
margin-left: $spacer / 3;
margin-right: $spacer / 3;
&::after {
content: '';
position: absolute;
top: $knob-space;
left: $knob-space;
width: $knob-size;
height: $knob-size;
background-color: $brand-grey-light;
border-radius: 15rem;
transition: transform 0.2s $easing;
transform: translate3d(0, 0, 0);
}
}
.checkbox {
position: relative;
cursor: pointer;
[type='checkbox'],
.label {
width: 1px;
height: 1px;
border: 0;
clip: rect(0 0 0 0);
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
}
[type='checkbox'] {
&:checked {
+ .checkboxContainer {
.checkboxFake {
&::after {
transform: translate3d(100%, 0, 0);
}
}
}
}
}
}