- fix(studio): stop markBatchDone infinite recursion so batches complete - refactor(api): merge api-response into api and drop the duplicate module - refactor(media): extract shared media loader and URL validator - refactor(ui): extract shared LoadingSpinner for site and admin groups - refactor(dates): consolidate raw date formatting into formatDate util - refactor(logs): share a single generic log-list loader across tables - refactor(theme): merge both ColorField components and reuse contrast helpers - refactor(import): extract shared ImportErrorBanner and SearchInput - chore(): remove dead theme-editor-tabs after inlining tab components
40 lines
952 B
TypeScript
40 lines
952 B
TypeScript
import { Search, X } from "lucide-react";
|
|
import { Input } from "@/components/ui/input";
|
|
|
|
type SearchInputProps = {
|
|
value: string;
|
|
onChange: (value: string) => void;
|
|
placeholder?: string;
|
|
onClear?: () => void;
|
|
};
|
|
|
|
/** Admin search field with a leading search icon and optional clear button. */
|
|
export function SearchInput({
|
|
value,
|
|
onChange,
|
|
placeholder,
|
|
onClear,
|
|
}: SearchInputProps) {
|
|
return (
|
|
<div className="relative">
|
|
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
|
<Input
|
|
placeholder={placeholder}
|
|
value={value}
|
|
onChange={(e) => onChange(e.target.value)}
|
|
className="pl-9 h-9"
|
|
/>
|
|
{value && onClear && (
|
|
<button
|
|
type="button"
|
|
onClick={onClear}
|
|
className="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
|
|
aria-label="Clear search"
|
|
>
|
|
<X className="h-4 w-4" />
|
|
</button>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|