fix(ally): clear up confusion with the title of theme switch (#3215)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/3219/head
zhoulixiang 2 years ago committed by GitHub
parent 239d150692
commit 67610363bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"

Loading…
Cancel
Save