Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

fix: update command menu styles

Dillion Vermae617955cddb8
diff --git a/components/command-menu.tsx b/components/command-menu.tsx
index bcf88647..cc9b7b08 100644
--- a/components/command-menu.tsx
+++ b/components/command-menu.tsx
@@ -3,7 +3,13 @@
import * as React from "react";
import { useRouter } from "next/navigation";
import { DialogProps } from "@radix-ui/react-alert-dialog";
-import { Circle, File, Laptop, Moon, SunMedium } from "lucide-react";
+import {
+ CircleIcon,
+ FileIcon,
+ LaptopIcon,
+ MoonIcon,
+ SunIcon,
+} from "@radix-ui/react-icons";
import { useTheme } from "next-themes";
import { docsConfig } from "@/config/docs";
@@ -26,7 +32,16 @@ export function CommandMenu({ ...props }: DialogProps) {
React.useEffect(() => {
const down = (e: KeyboardEvent) => {
- if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
+ if ((e.key === "k" && (e.metaKey || e.ctrlKey)) || e.key === "/") {
+ if (
+ (e.target instanceof HTMLElement && e.target.isContentEditable) ||
+ e.target instanceof HTMLInputElement ||
+ e.target instanceof HTMLTextAreaElement ||
+ e.target instanceof HTMLSelectElement
+ ) {
+ return;
+ }
+
e.preventDefault();
setOpen((open) => !open);
}
@@ -46,14 +61,14 @@ export function CommandMenu({ ...props }: DialogProps) {
<Button
variant="outline"
className={cn(
- "relative w-full justify-start text-sm text-muted-foreground sm:pr-12 md:w-40 lg:w-64",
+ "relative h-8 w-full justify-start rounded-[0.5rem] bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-12 md:w-40 lg:w-64",
)}
onClick={() => setOpen(true)}
{...props}
>
<span className="hidden lg:inline-flex">Search documentation...</span>
<span className="inline-flex lg:hidden">Search...</span>
- <kbd className="pointer-events-none absolute right-1.5 top-1.5 hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex">
+ <kbd className="pointer-events-none absolute right-[0.3rem] top-[0.3rem] hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex">
<span className="text-xs">⌘</span>K
</kbd>
</Button>
@@ -72,7 +87,7 @@ export function CommandMenu({ ...props }: DialogProps) {
runCommand(() => router.push(navItem.href as string));
}}
>
- <File className="mr-2 size-4" />
+ <FileIcon className="mr-2 size-4" />
{navItem.title}
</CommandItem>
))}
@@ -88,7 +103,7 @@ export function CommandMenu({ ...props }: DialogProps) {
}}
>
<div className="mr-2 flex size-4 items-center justify-center">
- <Circle className="size-3" />
+ <CircleIcon className="size-3" />
</div>
{navItem.title}
</CommandItem>
@@ -98,15 +113,15 @@ export function CommandMenu({ ...props }: DialogProps) {
<CommandSeparator />
<CommandGroup heading="Theme">
<CommandItem onSelect={() => runCommand(() => setTheme("light"))}>
- <SunMedium className="mr-2 size-4" />
+ <SunIcon className="mr-2 size-4" />
Light
</CommandItem>
<CommandItem onSelect={() => runCommand(() => setTheme("dark"))}>
- <Moon className="mr-2 size-4" />
+ <MoonIcon className="mr-2 size-4" />
Dark
</CommandItem>
<CommandItem onSelect={() => runCommand(() => setTheme("system"))}>
- <Laptop className="mr-2 size-4" />
+ <LaptopIcon className="mr-2 size-4" />
System
</CommandItem>
</CommandGroup>