import { Command } from "cmdk" import { useTranslate } from "@workspace/i18n" import { Button } from "@workspace/ui/components/button" import { ScrollArea } from "@workspace/ui/components/scroll-area" import { cn } from "@workspace/ui/lib/utils" import { HistoryIcon, Trash2Icon, XIcon } from "@workspace/ui/components/icon" import { searchMessages } from "./messages" export interface SearchHistoryProps { className?: string items: readonly string[] onSelect: (keyword: string) => void onRemove: (keyword: string) => void onClear: () => void } export function SearchHistory({ className, items, onClear, onRemove, onSelect, }: SearchHistoryProps) { const t = useTranslate() return (
{t(searchMessages.history)}
{items.map((item) => ( onSelect(item)} className="flex cursor-pointer items-center gap-2 rounded-xl border border-sidebar-border/55 bg-popover p-2 shadow-xs transition-colors hover:bg-secondary [&>svg]:last:hidden" > {item} ))}
) }