1
- "use client"
1
+ "use client" ;
2
2
3
- import * as React from "react"
4
- import { useRouter } from "next/navigation"
5
- import { DialogProps } from "@radix-ui/react-alert- dialog"
3
+ import * as React from "react" ;
4
+ import { useRouter } from "next/navigation" ;
5
+ import { type DialogProps } from "@radix-ui/react-dialog" ;
6
6
import {
7
7
CircleIcon ,
8
8
FileIcon ,
9
9
LaptopIcon ,
10
10
MoonIcon ,
11
11
SunIcon ,
12
- } from "@radix-ui/react-icons"
13
- import { useTheme } from "next-themes"
12
+ } from "@radix-ui/react-icons" ;
13
+ import { useTheme } from "next-themes" ;
14
14
15
- import { docsConfig } from "@/site.config.ts"
16
- import { cn } from "@/lib/utils"
17
- import { Button } from "@/components/ui/button"
15
+ import { docsConfig } from "@/site.config.ts" ;
16
+ import { cn } from "@/lib/utils" ;
17
+ import { Button } from "@/components/ui/button" ;
18
18
import {
19
19
CommandDialog ,
20
20
CommandEmpty ,
@@ -23,12 +23,12 @@ import {
23
23
CommandItem ,
24
24
CommandList ,
25
25
CommandSeparator ,
26
- } from "@/components/ui/command"
26
+ } from "@/components/ui/command" ;
27
27
28
28
export function CommandMenu ( { ...props } : DialogProps ) {
29
- const router = useRouter ( )
30
- const [ open , setOpen ] = React . useState ( false )
31
- const { setTheme } = useTheme ( )
29
+ const router = useRouter ( ) ;
30
+ const [ open , setOpen ] = React . useState ( false ) ;
31
+ const { setTheme } = useTheme ( ) ;
32
32
33
33
React . useEffect ( ( ) => {
34
34
const down = ( e : KeyboardEvent ) => {
@@ -39,22 +39,22 @@ export function CommandMenu({ ...props }: DialogProps) {
39
39
e . target instanceof HTMLTextAreaElement ||
40
40
e . target instanceof HTMLSelectElement
41
41
) {
42
- return
42
+ return ;
43
43
}
44
44
45
- e . preventDefault ( )
46
- setOpen ( ( open ) => ! open )
45
+ e . preventDefault ( ) ;
46
+ setOpen ( ( open ) => ! open ) ;
47
47
}
48
- }
48
+ } ;
49
49
50
- document . addEventListener ( "keydown" , down )
51
- return ( ) => document . removeEventListener ( "keydown" , down )
52
- } , [ ] )
50
+ document . addEventListener ( "keydown" , down ) ;
51
+ return ( ) => document . removeEventListener ( "keydown" , down ) ;
52
+ } , [ ] ) ;
53
53
54
54
const runCommand = React . useCallback ( ( command : ( ) => unknown ) => {
55
- setOpen ( false )
56
- command ( )
57
- } , [ ] )
55
+ setOpen ( false ) ;
56
+ command ( ) ;
57
+ } , [ ] ) ;
58
58
59
59
return (
60
60
< >
@@ -84,7 +84,7 @@ export function CommandMenu({ ...props }: DialogProps) {
84
84
key = { navItem . href }
85
85
value = { navItem . title }
86
86
onSelect = { ( ) => {
87
- runCommand ( ( ) => router . push ( navItem . href as string ) )
87
+ runCommand ( ( ) => router . push ( navItem . href as string ) ) ;
88
88
} }
89
89
>
90
90
< FileIcon className = "mr-2 h-4 w-4" />
@@ -99,7 +99,7 @@ export function CommandMenu({ ...props }: DialogProps) {
99
99
key = { navItem . href }
100
100
value = { navItem . title }
101
101
onSelect = { ( ) => {
102
- runCommand ( ( ) => router . push ( navItem . href as string ) )
102
+ runCommand ( ( ) => router . push ( navItem . href as string ) ) ;
103
103
} }
104
104
>
105
105
< div className = "mr-2 flex h-4 w-4 items-center justify-center" >
@@ -128,5 +128,5 @@ export function CommandMenu({ ...props }: DialogProps) {
128
128
</ CommandList >
129
129
</ CommandDialog >
130
130
</ >
131
- )
131
+ ) ;
132
132
}
0 commit comments