Fix rendering errors while build (#33)

* Fix rendering errors while build.

* Add missing check.
This commit is contained in:
Alessandro Jean 2023-09-08 20:26:02 -03:00 committed by GitHub
parent 5c33c7a1c7
commit 01f1803c84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { inject } from "vue" import { inject, onMounted, ref } from "vue"
import { useData } from "vitepress" import { useData } from "vitepress"
import VPIconMoon from "vitepress/dist/client/theme-default/components/icons/VPIconMoon.vue" import VPIconMoon from "vitepress/dist/client/theme-default/components/icons/VPIconMoon.vue"
@ -11,7 +11,12 @@ const toggleAppearance = inject("toggle-appearance", () => {
isDark.value = !isDark.value isDark.value = !isDark.value
}) })
const supportsViewTransition = "startViewTransition" in document const supportsViewTransition = ref(false)
onMounted(() => {
supportsViewTransition.value = "startViewTransition" in document
&& window.matchMedia("(prefers-reduced-motion: no-preference)").matches
})
</script> </script>
<template> <template>