Files
supervisor-ui/components/logs/LogSearch.tsx

37 lines
982 B
TypeScript
Raw Normal View History

'use client';
import { Search, X } from 'lucide-react';
import { Input } from '@/components/ui/input';
import { Button } from '@/components/ui/button';
interface LogSearchProps {
value: string;
onChange: (value: string) => void;
placeholder?: string;
}
export function LogSearch({ value, onChange, placeholder = 'Search logs...' }: LogSearchProps) {
return (
<div className="relative flex-1 max-w-md">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input
type="text"
placeholder={placeholder}
value={value}
onChange={(e) => onChange(e.target.value)}
className="pl-9 pr-9"
/>
{value && (
<Button
variant="ghost"
size="sm"
onClick={() => onChange('')}
className="absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0"
>
<X className="h-4 w-4" />
</Button>
)}
</div>
);
}