mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-01-31 08:29:26 +01:00
Add view transition for toggle theme
This commit is contained in:
@@ -28,6 +28,15 @@ const navs = [
|
||||
icon: 'i-ph-address-book-duotone'
|
||||
}
|
||||
]
|
||||
|
||||
function toggleTheme() {
|
||||
if (!document.startViewTransition) {
|
||||
isDark.value = !isDark.value
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
document.startViewTransition(() => isDark.value = !isDark.value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -61,7 +70,7 @@ const navs = [
|
||||
variant="link"
|
||||
color="gray"
|
||||
size="sm"
|
||||
@click="isDark = !isDark"
|
||||
@click="toggleTheme()"
|
||||
/>
|
||||
</UTooltip>
|
||||
</ClientOnly>
|
||||
|
||||
Reference in New Issue
Block a user