Skip to content

Commit 4a50483

Browse files
committed
Fix DialogProps issue for CommandMenu component update
1 parent 6b77750 commit 4a50483

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/components/ui/command-menu.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
"use client"
1+
"use client";
22

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";
66
import {
77
CircleIcon,
88
FileIcon,
99
LaptopIcon,
1010
MoonIcon,
1111
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";
1414

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";
1818
import {
1919
CommandDialog,
2020
CommandEmpty,
@@ -23,12 +23,12 @@ import {
2323
CommandItem,
2424
CommandList,
2525
CommandSeparator,
26-
} from "@/components/ui/command"
26+
} from "@/components/ui/command";
2727

2828
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();
3232

3333
React.useEffect(() => {
3434
const down = (e: KeyboardEvent) => {
@@ -39,22 +39,22 @@ export function CommandMenu({ ...props }: DialogProps) {
3939
e.target instanceof HTMLTextAreaElement ||
4040
e.target instanceof HTMLSelectElement
4141
) {
42-
return
42+
return;
4343
}
4444

45-
e.preventDefault()
46-
setOpen((open) => !open)
45+
e.preventDefault();
46+
setOpen((open) => !open);
4747
}
48-
}
48+
};
4949

50-
document.addEventListener("keydown", down)
51-
return () => document.removeEventListener("keydown", down)
52-
}, [])
50+
document.addEventListener("keydown", down);
51+
return () => document.removeEventListener("keydown", down);
52+
}, []);
5353

5454
const runCommand = React.useCallback((command: () => unknown) => {
55-
setOpen(false)
56-
command()
57-
}, [])
55+
setOpen(false);
56+
command();
57+
}, []);
5858

5959
return (
6060
<>
@@ -84,7 +84,7 @@ export function CommandMenu({ ...props }: DialogProps) {
8484
key={navItem.href}
8585
value={navItem.title}
8686
onSelect={() => {
87-
runCommand(() => router.push(navItem.href as string))
87+
runCommand(() => router.push(navItem.href as string));
8888
}}
8989
>
9090
<FileIcon className="mr-2 h-4 w-4" />
@@ -99,7 +99,7 @@ export function CommandMenu({ ...props }: DialogProps) {
9999
key={navItem.href}
100100
value={navItem.title}
101101
onSelect={() => {
102-
runCommand(() => router.push(navItem.href as string))
102+
runCommand(() => router.push(navItem.href as string));
103103
}}
104104
>
105105
<div className="mr-2 flex h-4 w-4 items-center justify-center">
@@ -128,5 +128,5 @@ export function CommandMenu({ ...props }: DialogProps) {
128128
</CommandList>
129129
</CommandDialog>
130130
</>
131-
)
131+
);
132132
}

0 commit comments

Comments
 (0)