Abstract SettingsContext out

This commit is contained in:
1ilit
2024-03-09 22:39:46 +02:00
parent f3eb6d7c04
commit 6c0ebcf7bc
15 changed files with 210 additions and 210 deletions

View File

@@ -136,19 +136,7 @@ export default function BugReport() {
const [theme, setTheme] = useState("");
useEffect(() => {
const t = localStorage.getItem("theme");
setTheme(t);
if (t === "dark") {
const body = document.body;
if (body.hasAttribute("theme-mode")) {
body.setAttribute("theme-mode", "dark");
}
} else {
const body = document.body;
if (body.hasAttribute("theme-mode")) {
body.setAttribute("theme-mode", "light");
}
}
setTheme(localStorage.getItem("theme"));
document.title = "Report a bug | drawDB";
document.body.setAttribute("class", "theme");
}, [setTheme]);