mirror of
https://github.com/falsycat/ar.falsy.cat.git
synced 2024-11-14 15:34:51 +00:00
1313bd9779
Having the CSS and JS in the html template produces pages larger than necessary, as each page need to contain all the js/css. Separating them in appropriate files allow the browser to just download them once and use them for all the pages. This is even more effective with an aggressive cache policy for the js and css, something that can be done without fear thanks to the implemented cache-busting. Also, having then in separate files allows us to use Hugo pipelines for minimizing the code.
44 lines
625 B
SCSS
44 lines
625 B
SCSS
.darkmode {
|
|
float: right;
|
|
padding: 1em;
|
|
min-width: 30px;
|
|
position: relative;
|
|
|
|
@media all and (max-width: 450px) {
|
|
padding: 1em;
|
|
}
|
|
|
|
& > .toggle {
|
|
display: none;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
& svg {
|
|
opacity: 0;
|
|
position: absolute;
|
|
width: 20px;
|
|
height: 20px;
|
|
top: calc(50% - 10px);
|
|
margin: 0 7px;
|
|
fill: var(--gray);
|
|
transition: opacity 0.1s ease;
|
|
}
|
|
}
|
|
|
|
.toggle:checked ~ label {
|
|
& > #dayIcon {
|
|
opacity: 0;
|
|
}
|
|
& > #nightIcon {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.toggle:not(:checked) ~ label {
|
|
& > #dayIcon {
|
|
opacity: 1;
|
|
}
|
|
& > #nightIcon {
|
|
opacity: 0;
|
|
}
|
|
} |