Add theme toggle with shortcuts

This commit is contained in:
2024-06-30 01:02:52 +02:00
parent 953c6cdc27
commit ae224396fc

View File

@@ -50,7 +50,8 @@ defineShortcuts({
h: () => router.push('/'), h: () => router.push('/'),
u: () => router.push('/uses'), u: () => router.push('/uses'),
w: () => router.push('/writings'), w: () => router.push('/writings'),
r: () => window.open(config.public.cloud.resume, '_blank') r: () => window.open(config.public.cloud.resume, '_blank'),
t: () => toggleTheme()
}) })
</script> </script>
@@ -80,7 +81,10 @@ defineShortcuts({
/> />
</UTooltip> </UTooltip>
<ClientOnly> <ClientOnly>
<UTooltip text="switch theme"> <UTooltip
:shortcuts="['T']"
text="switch theme"
>
<UButton <UButton
:icon="isDark ? 'i-ph-moon-duotone' : 'i-ph-sun-duotone'" :icon="isDark ? 'i-ph-moon-duotone' : 'i-ph-sun-duotone'"
color="white" color="white"