blob: abb19f5efd3fafb447c2c72136c417b7b41634ba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import React from "react";
import { Input } from "@/components/ui/input";
import { useDoBookmarkSearch } from "@/lib/hooks/bookmark-search";
import { cn } from "@/lib/utils";
const SearchInput = React.forwardRef<
HTMLInputElement,
React.HTMLAttributes<HTMLInputElement> & { loading?: boolean }
>(({ className, loading = false, ...props }, ref) => {
const { debounceSearch, searchQuery } = useDoBookmarkSearch();
return (
<Input
ref={ref}
placeholder="Search"
defaultValue={searchQuery}
onChange={(e) => debounceSearch(e.target.value)}
className={cn(loading ? "animate-pulse-border" : undefined, className)}
{...props}
/>
);
});
SearchInput.displayName = "SearchInput";
export { SearchInput };
|