33 <template #left >
44 <UPageAside >
55 <template #top >
6- <UInput v-model =" search" placeholder =" Filter..." />
6+ <UInput v-model =" search" placeholder =" Filter..." >
7+ <template v-if =" search ?.length " #trailing >
8+ <UButton
9+ size =" sm"
10+ variant =" link"
11+ color =" neutral"
12+ icon =" i-lucide-circle-x"
13+ aria-label =" Verwijder filter"
14+ @click =" search = ''"
15+ />
16+ </template >
17+ </UInput >
718 </template >
819 <UPageLinks :links =" links" />
920 </UPageAside >
1223 <UPageHeader :title =" title" :description =" description" />
1324
1425 <UPageBody >
26+ <UInputMenu
27+ virtualize
28+ :items =" menuItems"
29+ placeholder =" Zoeken..."
30+ :filter-fields =" ['value', 'text', 'reference']"
31+ />
1532 <NuxtPage />
1633 </UPageBody >
1734 </UPage >
1835</template >
1936<script setup lang="ts">
20- import type { PageAnchor } from " @nuxt/ui" ;
37+ import type { InputMenuItem } from " @nuxt/ui" ;
2138
2239const title = " Vertalen" ;
2340const description = " Vertaal op deze pagina de teksten." ;
@@ -33,7 +50,7 @@ const importStore = useImportStore();
3350
3451const search = ref (" " );
3552
36- const links = computed ((): PageAnchor [] =>
53+ const links = computed ((): PageLink [] =>
3754 importStore .keys
3855 .filter ((key ) => {
3956 if (! search .value || search .value .trim ().length < 3 ) return true ;
@@ -52,4 +69,26 @@ const links = computed((): PageAnchor[] =>
5269 to: ` /translate/${key } ` ,
5370 })),
5471);
72+
73+ const menuItems = computed ((): InputMenuItem [] =>
74+ links .value .map ((link ) => ({
75+ label: link .label ,
76+ onSelect : () => {
77+ navigateTo (link .to );
78+ },
79+ reference: importStore .references [link .label ],
80+ text: importStore .translations [link .label ],
81+ value: link .label ,
82+ })),
83+ );
84+
85+ const pageStore = usePageStore ();
86+
87+ watchImmediate (links , (links ) => {
88+ pageStore .pageLinks = links ;
89+ });
90+
91+ onBeforeUnmount (() => {
92+ pageStore .pageLinks = [];
93+ });
5594 </script >
0 commit comments