admin: move theme icon to top left; add icon

This commit is contained in:
Harvey Tindall
2021-12-24 19:34:18 +00:00
parent 535a100314
commit aedea1bea6
2 changed files with 24 additions and 2 deletions
+23 -1
View File
@@ -10,7 +10,29 @@ import { _get, _post, notificationBox, whichAnimationEvent, toggleLoader } from
import { Updater } from "./modules/update.js";
loadTheme();
(document.getElementById('button-theme') as HTMLSpanElement).onclick = toggleTheme;
const themeButton = document.getElementById('button-theme') as HTMLSpanElement;
const switchThemeIcon = () => {
const icon = themeButton.childNodes[0] as HTMLElement;
if (document.documentElement.classList.contains("dark-theme")) {
icon.classList.add("ri-sun-line");
icon.classList.remove("ri-moon-line");
themeButton.classList.add("~warning");
themeButton.classList.remove("~neutral");
themeButton.classList.remove("!high");
} else {
icon.classList.add("ri-moon-line");
icon.classList.remove("ri-sun-line");
themeButton.classList.add("!high");
themeButton.classList.add("~neutral");
themeButton.classList.remove("~warning");
}
};
themeButton.onclick = () => {
toggleTheme();
switchThemeIcon();
}
switchThemeIcon();
window.lang = new lang(window.langFile as LangFile);
loadLangSelector("admin");