@@ -7,37 +7,48 @@ onPrehydrate(el => {
77 const settingsSaved = JSON .parse (localStorage .getItem (' npmx-settings' ) || ' {}' )
88 const enabled = settingsSaved .instantSearch
99 if (enabled === false ) {
10- el .classList .add (' hidden' )
10+ el .querySelector (' [data-instant-search-on]' )! .className = ' hidden'
11+ el .querySelector (' [data-instant-search-off]' )! .className = ' '
1112 }
1213})
1314 </script >
1415
1516<template >
16- <p
17- id =" instant-search-advisory"
18- class =" text-fg-muted text-sm text-pretty"
19- :class =" settings.instantSearch ? '' : 'hidden'"
20- >
17+ <p id =" instant-search-advisory" class =" text-fg-muted text-sm text-pretty" >
2118 <span
2219 class =" i-lucide:zap align-middle text-fg relative top-[-0.1em] me-1"
2320 style =" font-size : 0.8em "
2421 aria-hidden =" true"
25- ></span >
26- <i18n-t keypath =" search.instant_search_advisory" >
27- <template #label >
28- <strong >{{ $t('search.instant_search') }}</strong >
29- </template >
30- <template #settings >
31- <LinkBase to =" /settings" >{{ $t('settings.title') }}</LinkBase >
32- </template >
33- <template #shortcut >
34- <kbd class =" text-xs"
35- ><kbd class =" text-fg bg-bg-muted border border-border px-1 py-[2px] rounded-sm" >Ctrl</kbd
36- >+<kbd class =" text-fg bg-bg-muted border border-border px-1 py-[2px] rounded-sm"
37- >/</kbd
38- ></kbd
39- >
40- </template >
41- </i18n-t >
22+ />
23+ <span data-instant-search-on :class =" settings.instantSearch ? '' : 'hidden'" >
24+ <i18n-t keypath =" search.instant_search_advisory" >
25+ <template #label >
26+ {{ $t('search.instant_search') }}
27+ </template >
28+ <template #state >
29+ <strong >{{ $t('search.instant_search_on') }}</strong >
30+ </template >
31+ <template #action >
32+ <button type =" button" class =" underline" @click =" settings.instantSearch = false" >
33+ {{ $t('search.instant_search_turn_off') }}
34+ </button >
35+ </template >
36+ </i18n-t >
37+ </span >
38+ <span data-instant-search-off :class =" settings.instantSearch ? 'hidden' : ''" >
39+ <i18n-t keypath =" search.instant_search_advisory" >
40+ <template #label >
41+ {{ $t('search.instant_search') }}
42+ </template >
43+ <template #state >
44+ <strong >{{ $t('search.instant_search_off') }}</strong >
45+ </template >
46+ <template #action >
47+ <button type =" button" class =" underline" @click =" settings.instantSearch = true" >
48+ {{ $t('search.instant_search_turn_on') }}
49+ </button >
50+ </template >
51+ </i18n-t >
52+ </span >
4253 </p >
4354</template >
0 commit comments