import { type RefObject } from 'react'; import { Search, X } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { getSearchShortcutLabel } from './constants'; interface SearchInputProps { inputRef: RefObject; searchQuery: string; onSearchQueryChange: (value: string) => void; onFocus: () => void; onKeyDown: (e: React.KeyboardEvent) => void; onClear: () => void; } export default function SearchInput({ inputRef, searchQuery, onSearchQueryChange, onFocus, onKeyDown, onClear, }: SearchInputProps) { return (
onSearchQueryChange(e.target.value)} onFocus={onFocus} onKeyDown={onKeyDown} aria-label="搜索工具..." className="h-9 rounded-lg border-border/60 bg-muted/40 pl-9 pr-16 shadow-none focus-visible:ring-1 focus-visible:ring-offset-0 placeholder:text-muted-foreground/50" /> {!searchQuery && ( {getSearchShortcutLabel()} )} {searchQuery && ( )}
); }