'use client' import { memo } from 'react' import { Search, X } from 'lucide-react' import { useSearch } from '@/hooks' interface SearchBarProps { onSearch: (query: string) => void placeholder?: string debounceMs?: number initialValue?: string } function SearchBar({ onSearch, placeholder = 'Search tasks...', debounceMs = 300, initialValue = '' }: SearchBarProps) { const { query, setQuery, clearSearch, isDebouncing } = useSearch({ debounceMs, onSearch }) return (
setQuery(e.target.value)} placeholder={placeholder} className="w-full pl-10 sm:pl-12 pr-10 sm:pr-12 py-3 sm:py-3.5 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base transition-shadow" /> {query && ( )} {isDebouncing && (
)}
) } export default memo(SearchBar)