From 0e95caaee98d24fa61d18a52385e81efe507b97f Mon Sep 17 00:00:00 2001 From: henrygd Date: Fri, 29 Aug 2025 15:04:26 -0400 Subject: [PATCH] update command ui component --- .../site/src/components/command-palette.tsx | 2 +- beszel/site/src/components/ui/command.tsx | 198 +++++++++--------- 2 files changed, 100 insertions(+), 100 deletions(-) diff --git a/beszel/site/src/components/command-palette.tsx b/beszel/site/src/components/command-palette.tsx index eca1dd6..10cbe2c 100644 --- a/beszel/site/src/components/command-palette.tsx +++ b/beszel/site/src/components/command-palette.tsx @@ -71,7 +71,7 @@ export default memo(function CommandPalette({ open, setOpen }: { open: boolean; }} > - {system.name} + {system.name} {getHostDisplayValue(system)} ))} diff --git a/beszel/site/src/components/ui/command.tsx b/beszel/site/src/components/ui/command.tsx index e1d49da..4b5c22f 100644 --- a/beszel/site/src/components/ui/command.tsx +++ b/beszel/site/src/components/ui/command.tsx @@ -1,33 +1,41 @@ import * as React from "react" -import { DialogTitle, type DialogProps } from "@radix-ui/react-dialog" import { Command as CommandPrimitive } from "cmdk" -import { Search } from "lucide-react" +import { SearchIcon } from "lucide-react" import { cn } from "@/lib/utils" -import { Dialog, DialogContent } from "@/components/ui/dialog" +import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" -const Command = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -Command.displayName = CommandPrimitive.displayName +function Command({ className, ...props }: React.ComponentProps) { + return ( + + ) +} -interface CommandDialogProps extends DialogProps {} - -const CommandDialog = ({ children, ...props }: CommandDialogProps) => { +function CommandDialog({ + title = "Command Palette", + description = "Search for a command to run...", + children, + className, + showCloseButton = true, + ...props +}: React.ComponentProps & { + title?: string + description?: string + className?: string + showCloseButton?: boolean +}) { return ( - -
- Command -
- + + {title} + {description} + + + {children} @@ -35,89 +43,81 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => { ) } -const CommandInput = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( -
- - ) { + return ( +
+ + +
+ ) +} + +function CommandList({ className, ...props }: React.ComponentProps) { + return ( + + ) +} + +function CommandEmpty({ ...props }: React.ComponentProps) { + return +} + +function CommandGroup({ className, ...props }: React.ComponentProps) { + return ( + -
-)) - -CommandInput.displayName = CommandPrimitive.Input.displayName - -const CommandList = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) - -CommandList.displayName = CommandPrimitive.List.displayName - -const CommandEmpty = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->((props, ref) => ) - -CommandEmpty.displayName = CommandPrimitive.Empty.displayName - -const CommandGroup = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) - -CommandGroup.displayName = CommandPrimitive.Group.displayName - -const CommandSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -CommandSeparator.displayName = CommandPrimitive.Separator.displayName - -const CommandItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) - -CommandItem.displayName = CommandPrimitive.Item.displayName - -const CommandShortcut = ({ className, ...props }: React.HTMLAttributes) => { - return + ) +} + +function CommandSeparator({ className, ...props }: React.ComponentProps) { + return ( + + ) +} + +function CommandItem({ className, ...props }: React.ComponentProps) { + return ( + + ) +} + +function CommandShortcut({ className, ...props }: React.ComponentProps<"span">) { + return ( + + ) } -CommandShortcut.displayName = "CommandShortcut" export { Command,