Start work on dark-mode, fix heading scroll position

This commit is contained in:
Riyyi
2025-03-31 15:02:51 +02:00
parent c26c74a2fb
commit 86e08604dd
18 changed files with 243 additions and 53 deletions
+16
View File
@@ -0,0 +1,16 @@
import { defineStore } from "pinia"
import { ref } from "vue";
export const useStateStore = defineStore("state", () => {
const colorMode = ref<string>("light");
const toggleColorMode = (): void => {
colorMode.value = colorMode.value === "dark" ? "light" : "dark";
const html = document.querySelector("html") as HTMLElement;
html.setAttribute('data-bs-theme', colorMode.value);
};
return { colorMode, toggleColorMode }
}, {
persist: process.env.NODE_ENV === 'development' ? true : false,
})