diff options
| author | Ankit Bahl <ankit2bahl@gmail.com> | 2024-01-19 13:38:18 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-19 16:38:18 -0500 |
| commit | ae7cb2ccc84cf25332d1efabeb197a5e1b05d029 (patch) | |
| tree | ba9df97e54789962dda8fcdc10d06b23696c9558 /src/components/ui | |
| parent | 3735509fea74afddb3d5bc0eab57c3f03a239354 (diff) | |
Added search bar for expense list page (#52)
* Added search bar for expense list page
* Change search input styling
---------
Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
Diffstat (limited to 'src/components/ui')
| -rw-r--r-- | src/components/ui/search-bar.tsx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components/ui/search-bar.tsx b/src/components/ui/search-bar.tsx new file mode 100644 index 0000000..6369c55 --- /dev/null +++ b/src/components/ui/search-bar.tsx @@ -0,0 +1,33 @@ +import * as React from "react" + +import {Input} from "@/components/ui/input"; +import {cn} from "@/lib/utils"; +import { + Search +} from 'lucide-react' + +export interface InputProps + extends React.InputHTMLAttributes<HTMLInputElement> {} + +const SearchBar = React.forwardRef<HTMLInputElement, InputProps>( + ({ className, type, ...props }, ref) => { + return ( + <div className="mx-4 sm:mx-6 flex relative"> + <Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" /> + <Input + type={type} + className={cn( + "pl-10 text-sm focus:text-base bg-muted border-none text-muted-foreground", + className + )} + ref={ref} + placeholder="Search for an expense…" + {...props} + /> + </div> + ) + } +) +SearchBar.displayName = "SearchBar" + +export { SearchBar } |
