Animate dark mode
This commit is contained in:
parent
727ad725d1
commit
366d135285
3 changed files with 11 additions and 1 deletions
|
@ -30,4 +30,8 @@ window.addEventListener("load", () => {
|
|||
darkModeToggle.addEventListener("click", () => {
|
||||
handleDarkMode(window.localStorage.getItem(STORAGE_KEY) !== "true");
|
||||
});
|
||||
|
||||
window.setTimeout(() => {
|
||||
body.classList.add("dark-mode-animate");
|
||||
}, 1000);
|
||||
});
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
@mixin dark-mode {
|
||||
// Ensure animations aren't for the initial transition
|
||||
body.dark-mode-animate & {
|
||||
transition-duration: 0.5s;
|
||||
transition-property: color, background-color;
|
||||
}
|
||||
|
||||
body.dark-mode & {
|
||||
@content;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
}
|
||||
|
||||
#dark-mode-toggle i {
|
||||
transition: transform 0.3s;
|
||||
transition: transform 0.5s !important;
|
||||
|
||||
@include dark-mode {
|
||||
transform: rotate(180deg);
|
||||
|
|
Loading…
Reference in a new issue