From fe9d154915a0f047bf76216888232b0ad44e7649 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Sun, 30 Jun 2024 01:00:15 +0200 Subject: [PATCH] Use shortcuts --- app/components/AppHeader.vue | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/app/components/AppHeader.vue b/app/components/AppHeader.vue index d4b9e2f..72e5cb7 100644 --- a/app/components/AppHeader.vue +++ b/app/components/AppHeader.vue @@ -10,23 +10,27 @@ const navs = [ { label: 'home', to: '/', - icon: 'i-ph-house-line-duotone' + icon: 'i-ph-house-line-duotone', + shortcut: 'h' }, { label: 'uses', to: '/uses', - icon: 'i-ph-briefcase-duotone' + icon: 'i-ph-briefcase-duotone', + shortcut: 'u' }, { label: 'writings', to: '/writings', - icon: 'i-ph-newspaper-clipping-duotone' + icon: 'i-ph-newspaper-clipping-duotone', + shortcut: 'w' }, { label: 'resume', to: config.public.cloud.resume, target: '_blank', - icon: 'i-ph-address-book-duotone' + icon: 'i-ph-address-book-duotone', + shortcut: 'r' } ] @@ -40,6 +44,14 @@ async function toggleTheme() { await new Promise(resolve => setTimeout(resolve, 500)) document.body.style.animation = '' } + +const router = useRouter() +defineShortcuts({ + h: () => router.push('/'), + u: () => router.push('/uses'), + w: () => router.push('/writings'), + r: () => window.open(config.public.cloud.resume, '_blank') +})