11<script setup lang="ts">
22const route = useRoute ()
33const isHome = computed (() => route .name === ' index' )
4+
5+ const modalRef = useTemplateRef (' modalRef' )
6+ const showModal = () => modalRef .value ?.showModal ?.()
47 </script >
58
69<template >
@@ -11,7 +14,6 @@ const isHome = computed(() => route.name === 'index')
1114 >
1215 <div >
1316 <p class =" font-mono text-balance m-0 hidden sm:block" >{{ $t('tagline') }}</p >
14- <BuildEnvironment v-if =" !isHome" footer />
1517 </div >
1618 <!-- Desktop: Show all links. Mobile: Links are in MobileMenu -->
1719 <div class =" hidden sm:flex items-center gap-6 min-h-11 text-xs" >
@@ -33,12 +35,86 @@ const isHome = computed(() => route.name === 'index')
3335 <LinkBase to =" https://chat.npmx.dev" >
3436 {{ $t('footer.chat') }}
3537 </LinkBase >
38+
39+ <button
40+ type =" button"
41+ class =" group inline-flex gap-x-1 items-center justify-center underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200"
42+ @click.prevent =" showModal"
43+ aria-haspopup =" dialog"
44+ >
45+ {{ $t('footer.keyboard_shortcuts') }}
46+ </button >
47+
48+ <Modal
49+ ref =" modalRef"
50+ :modalTitle =" $t('footer.keyboard_shortcuts')"
51+ class =" w-auto max-w-lg"
52+ >
53+ <p class =" mb-2 font-mono text-fg-subtle" >
54+ {{ $t('shortcuts.section.global') }}
55+ </p >
56+ <ul class =" mb-6 flex flex-col gap-2" >
57+ <li class =" flex gap-2 items-center" >
58+ <kbd class =" kbd" >/</kbd >
59+ <span >{{ $t('shortcuts.focus_search') }}</span >
60+ </li >
61+ <li class =" flex gap-2 items-center" >
62+ <kbd class =" kbd" >?</kbd >
63+ <span >{{ $t('shortcuts.show_kbd_hints') }}</span >
64+ </li >
65+ <li class =" flex gap-2 items-center" >
66+ <kbd class =" kbd" >,</kbd >
67+ <span >{{ $t('shortcuts.settings') }}</span >
68+ </li >
69+ <li class =" flex gap-2 items-center" >
70+ <kbd class =" kbd" >c</kbd >
71+ <span >{{ $t('shortcuts.compare') }}</span >
72+ </li >
73+ </ul >
74+ <p class =" mb-2 font-mono text-fg-subtle" >
75+ {{ $t('shortcuts.section.search') }}
76+ </p >
77+ <ul class =" mb-6 flex flex-col gap-2" >
78+ <li class =" flex gap-2 items-center" >
79+ <kbd class =" kbd" >↑</kbd >/<kbd class =" kbd" >↓</kbd >
80+ <span >{{ $t('shortcuts.navigate_results') }}</span >
81+ </li >
82+ <li class =" flex gap-2 items-center" >
83+ <kbd class =" kbd" >Enter</kbd >
84+ <span >{{ $t('shortcuts.go_to_result') }}</span >
85+ </li >
86+ </ul >
87+ <p class =" mb-2 font-mono text-fg-subtle" >
88+ {{ $t('shortcuts.section.package') }}
89+ </p >
90+ <ul class =" mb-6 flex flex-col gap-2" >
91+ <li class =" flex gap-2 items-center" >
92+ <kbd class =" kbd" >.</kbd >
93+ <span >{{ $t('shortcuts.open_code_view') }}</span >
94+ </li >
95+ <li class =" flex gap-2 items-center" >
96+ <kbd class =" kbd" >d</kbd >
97+ <span >{{ $t('shortcuts.open_docs') }}</span >
98+ </li >
99+ <li class =" flex gap-2 items-center" >
100+ <kbd class =" kbd" >c</kbd >
101+ <span >{{ $t('shortcuts.compare_from_package') }}</span >
102+ </li >
103+ </ul >
104+ </Modal >
36105 </div >
37106 </div >
107+ <BuildEnvironment v-if =" !isHome" footer />
38108 <p class =" text-xs text-fg-muted text-center sm:text-start m-0" >
39109 <span class =" sm:hidden" >{{ $t('non_affiliation_disclaimer') }}</span >
40110 <span class =" hidden sm:inline" >{{ $t('trademark_disclaimer') }}</span >
41111 </p >
42112 </div >
43113 </footer >
44114</template >
115+
116+ <style scoped>
117+ .kbd {
118+ @apply items-center justify-center text-sm text-fg bg-bg-muted border border-border rounded px- 2;
119+ }
120+ </style >
0 commit comments