import { Command } from "cmdk" import { CommandSeparator, CommandShortcut } from "@/components/ui/command" import { LaIcon } from "../la-icon" import { CommandItemType, CommandAction } from "./command-data" import { HTMLLikeElement, renderHTMLLikeElement } from "@/lib/utils" export interface CommandItemProps extends Omit { action: CommandAction handleAction: (action: CommandAction, payload?: any) => void } const HTMLLikeRenderer: React.FC<{ content: HTMLLikeElement | string }> = ({ content }) => { return <>{renderHTMLLikeElement(content)} } export const CommandItem: React.FC = ({ icon, label, action, payload, shortcut, handleAction }) => ( handleAction(action, payload)}> {icon && } {shortcut && {shortcut}} ) export interface CommandGroupProps { heading?: string items: CommandItemType[] handleAction: (action: CommandAction, payload?: any) => void isLastGroup: boolean } export const CommandGroup: React.FC = ({ heading, items, handleAction, isLastGroup }) => { return ( <> {heading ? ( {items.map((item, index) => ( ))} ) : ( items.map((item, index) => ( )) )} {!isLastGroup && } ) }