diff options
| author | MohamedBassem <me@mbassem.com> | 2024-03-10 20:27:59 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-03-10 20:27:59 +0000 |
| commit | 364e82c7f2f10759b437c0282021d5dfef98c922 (patch) | |
| tree | 3760491f24b4c25d8d5c826fba9d796d48172550 /packages/web/components/dashboard/search | |
| parent | d6dd76021226802adf5295b3243d6f2ae4fa5cc2 (diff) | |
| download | karakeep-364e82c7f2f10759b437c0282021d5dfef98c922.tar.zst | |
feature: Change top nav to include search and move add link to a modal
Diffstat (limited to 'packages/web/components/dashboard/search')
| -rw-r--r-- | packages/web/components/dashboard/search/SearchInput.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/web/components/dashboard/search/SearchInput.tsx b/packages/web/components/dashboard/search/SearchInput.tsx new file mode 100644 index 00000000..73d14c90 --- /dev/null +++ b/packages/web/components/dashboard/search/SearchInput.tsx @@ -0,0 +1,25 @@ +import { Input } from "@/components/ui/input"; +import { useDoBookmarkSearch } from "@/lib/hooks/bookmark-search"; +import { cn } from "@/lib/utils"; +import React from "react"; + +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 }; |
