This commit is contained in:
Alessio Gravili 2022-02-20 16:38:19 +01:00 committed by MiniDigger | Martin
parent a88779bacc
commit 6b33e3dd1e
2 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,5 @@
<script setup lang="ts">
import { useHead } from "@vueuse/head";
import {ref} from 'vue';
import { useSeo } from "~/composables/useSeo";
import { useThemeStore } from '~/store/theme'
@ -15,7 +14,7 @@ if (typeof window !== 'undefined') {
theme.darkMode = (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches));
if (unref(theme.darkMode)){
if (theme.darkMode){
document.documentElement.classList.add('dark');
}else{
document.documentElement.classList.add('light');

View File

@ -1,8 +1,8 @@
import { defineStore } from 'pinia'
import {ref, unref} from 'vue';
import {Ref, ref, unref} from 'vue';
export const useThemeStore = defineStore('theme', () => {
const darkMode = ref(false);
const darkMode: Ref<boolean> = ref(false);
function toggleDarkMode() {