[READ-ONLY] a fast, modern browser for the npm registry
at main 126 lines 4.9 kB view raw
1<script setup lang="ts"> 2import { NPMX_DOCS_SITE } from '#shared/utils/constants' 3 4const route = useRoute() 5const isHome = computed(() => route.name === 'index') 6 7const modalRef = useTemplateRef('modalRef') 8const showModal = () => modalRef.value?.showModal?.() 9</script> 10 11<template> 12 <footer class="border-t border-border mt-auto"> 13 <div class="container py-3 sm:py-8 flex flex-col gap-2 sm:gap-4 text-fg-subtle text-sm"> 14 <div 15 class="flex flex-col sm:flex-row sm:flex-wrap items-center sm:items-baseline justify-between gap-2 sm:gap-4" 16 > 17 <div> 18 <p class="font-mono text-balance m-0 hidden sm:block"> 19 {{ $t('tagline') }} 20 </p> 21 </div> 22 <!-- Desktop: Show all links. Mobile: Links are in MobileMenu --> 23 <div class="hidden sm:flex items-center gap-6 min-h-11 text-xs"> 24 <LinkBase :to="{ name: 'about' }"> 25 {{ $t('footer.about') }} 26 </LinkBase> 27 <LinkBase :to="{ name: 'privacy' }"> 28 {{ $t('privacy_policy.title') }} 29 </LinkBase> 30 <LinkBase :to="{ name: 'accessibility' }"> 31 {{ $t('a11y.footer_title') }} 32 </LinkBase> 33 <button 34 type="button" 35 class="cursor-pointer 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" 36 @click.prevent="showModal" 37 aria-haspopup="dialog" 38 > 39 {{ $t('footer.keyboard_shortcuts') }} 40 </button> 41 42 <Modal 43 ref="modalRef" 44 :modalTitle="$t('footer.keyboard_shortcuts')" 45 class="w-auto max-w-lg" 46 > 47 <p class="mb-2 font-mono text-fg-subtle"> 48 {{ $t('shortcuts.section.global') }} 49 </p> 50 <ul class="mb-6 flex flex-col gap-2"> 51 <li class="flex gap-2 items-center"> 52 <kbd class="kbd">/</kbd> 53 <span>{{ $t('shortcuts.focus_search') }}</span> 54 </li> 55 <li class="flex gap-2 items-center"> 56 <kbd class="kbd">?</kbd> 57 <span>{{ $t('shortcuts.show_kbd_hints') }}</span> 58 </li> 59 <li class="flex gap-2 items-center"> 60 <kbd class="kbd">,</kbd> 61 <span>{{ $t('shortcuts.settings') }}</span> 62 </li> 63 <li class="flex gap-2 items-center"> 64 <kbd class="kbd">c</kbd> 65 <span>{{ $t('shortcuts.compare') }}</span> 66 </li> 67 </ul> 68 <p class="mb-2 font-mono text-fg-subtle"> 69 {{ $t('shortcuts.section.search') }} 70 </p> 71 <ul class="mb-6 flex flex-col gap-2"> 72 <li class="flex gap-2 items-center"> 73 <kbd class="kbd"></kbd>/<kbd class="kbd"></kbd> 74 <span>{{ $t('shortcuts.navigate_results') }}</span> 75 </li> 76 <li class="flex gap-2 items-center"> 77 <kbd class="kbd">Enter</kbd> 78 <span>{{ $t('shortcuts.go_to_result') }}</span> 79 </li> 80 </ul> 81 <p class="mb-2 font-mono text-fg-subtle"> 82 {{ $t('shortcuts.section.package') }} 83 </p> 84 <ul class="mb-6 flex flex-col gap-2"> 85 <li class="flex gap-2 items-center"> 86 <kbd class="kbd">.</kbd> 87 <span>{{ $t('shortcuts.open_code_view') }}</span> 88 </li> 89 <li class="flex gap-2 items-center"> 90 <kbd class="kbd">d</kbd> 91 <span>{{ $t('shortcuts.open_docs') }}</span> 92 </li> 93 <li class="flex gap-2 items-center"> 94 <kbd class="kbd">c</kbd> 95 <span>{{ $t('shortcuts.compare_from_package') }}</span> 96 </li> 97 </ul> 98 </Modal> 99 <LinkBase :to="NPMX_DOCS_SITE"> 100 {{ $t('footer.docs') }} 101 </LinkBase> 102 <LinkBase to="https://repo.npmx.dev"> 103 {{ $t('footer.source') }} 104 </LinkBase> 105 <LinkBase to="https://social.npmx.dev"> 106 {{ $t('footer.social') }} 107 </LinkBase> 108 <LinkBase to="https://chat.npmx.dev"> 109 {{ $t('footer.chat') }} 110 </LinkBase> 111 </div> 112 </div> 113 <BuildEnvironment v-if="!isHome" footer /> 114 <p class="text-xs text-fg-muted text-center sm:text-start m-0"> 115 <span class="sm:hidden">{{ $t('non_affiliation_disclaimer') }}</span> 116 <span class="hidden sm:inline">{{ $t('trademark_disclaimer') }}</span> 117 </p> 118 </div> 119 </footer> 120</template> 121 122<style scoped> 123.kbd { 124 @apply items-center justify-center text-sm text-fg bg-bg-muted border border-border rounded px-2; 125} 126</style>