|
|
@ -1,5 +1,5 @@
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { inject } from 'vue'
|
|
|
|
import { inject, computed } from 'vue'
|
|
|
|
import { useData } from '../composables/data'
|
|
|
|
import { useData } from '../composables/data'
|
|
|
|
import VPSwitch from './VPSwitch.vue'
|
|
|
|
import VPSwitch from './VPSwitch.vue'
|
|
|
|
import VPIconMoon from './icons/VPIconMoon.vue'
|
|
|
|
import VPIconMoon from './icons/VPIconMoon.vue'
|
|
|
@ -10,11 +10,15 @@ const { isDark } = useData()
|
|
|
|
const toggleAppearance = inject('toggle-appearance', () => {
|
|
|
|
const toggleAppearance = inject('toggle-appearance', () => {
|
|
|
|
isDark.value = !isDark.value
|
|
|
|
isDark.value = !isDark.value
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const switchTitle = computed(() => {
|
|
|
|
|
|
|
|
return isDark.value ? 'Switch to light theme' : 'Switch to dark theme'
|
|
|
|
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<VPSwitch
|
|
|
|
<VPSwitch
|
|
|
|
title="toggle dark mode"
|
|
|
|
:title="switchTitle"
|
|
|
|
class="VPSwitchAppearance"
|
|
|
|
class="VPSwitchAppearance"
|
|
|
|
:aria-checked="isDark"
|
|
|
|
:aria-checked="isDark"
|
|
|
|
@click="toggleAppearance"
|
|
|
|
@click="toggleAppearance"
|
|
|
|