File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import { onMount } from " svelte" ;
3+ import LucideSearch from " ~icons/lucide/search" ;
4+
5+ let shortcut = $state (" Ctrl+Shift+F" );
6+
7+ onMount (() => {
8+ if (navigator .userAgent .includes (" Mac" )) {
9+ shortcut = " ⇧⌘F" ;
10+ }
11+ });
12+
13+ function openNpmSearchDialog() {
14+ const dialog = document .querySelector <HTMLDialogElement >(" #npm-search-dialog" );
15+ if (! dialog || dialog .open ) return ;
16+ dialog .showModal ();
17+ }
18+ </script >
19+
20+ <div class =" contents md:hidden" >
21+ <button
22+ type =" button"
23+ class =" btn-sm-icon-outline"
24+ title =" Search npm packages"
25+ onclick ={openNpmSearchDialog }
26+ >
27+ <LucideSearch class =" size-4" />
28+ </button >
29+ </div >
30+
31+ <div class =" hidden md:contents" >
32+ <button
33+ type =" button"
34+ class =" btn-sm-outline"
35+ title =" Search npm packages"
36+ onclick ={openNpmSearchDialog }
37+ >
38+ <LucideSearch class =" size-4" />
39+ <span >Search npm packages</span >
40+ <kbd class ="kbd" >{shortcut }</kbd >
41+ </button >
42+ </div >
You can’t perform that action at this time.
0 commit comments