diff options
| author | Yash <[email protected]> | 2024-04-02 11:36:40 +0000 |
|---|---|---|
| committer | Yash <[email protected]> | 2024-04-02 11:36:40 +0000 |
| commit | 90eb9429fde5f06f08fed31531fefe6f1ebf75a5 (patch) | |
| tree | cb19cd6bade52c106ba2a3d8afb32508b538cf61 /apps/web/src/components | |
| parent | responsiveness (diff) | |
| download | supermemory-90eb9429fde5f06f08fed31531fefe6f1ebf75a5.tar.xz supermemory-90eb9429fde5f06f08fed31531fefe6f1ebf75a5.zip | |
input with icon
Diffstat (limited to 'apps/web/src/components')
| -rw-r--r-- | apps/web/src/components/ui/input.tsx | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx index 8a7a9340..dba310dc 100644 --- a/apps/web/src/components/ui/input.tsx +++ b/apps/web/src/components/ui/input.tsx @@ -20,6 +20,30 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>( ); }, ); -Input.displayName = "Input"; -export { Input }; +export interface InputWithIconProps + extends React.InputHTMLAttributes<HTMLInputElement> { + icon: React.ReactNode; +} + +const InputWithIcon = React.forwardRef<HTMLInputElement, InputWithIconProps>( + ({ className, type, icon, ...props }, ref) => { + return ( + <div className="border-rgray-6 text-rgray-12 ring-offset-rgray-2 focus-within:ring-rgray-7 flex h-10 w-full items-center justify-center gap-2 rounded-md border bg-transparent px-3 py-2 text-sm transition focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 "> + {icon} + <input + type={type} + className={cn( + "placeholder:text-rgray-11 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:cursor-not-allowed disabled:opacity-50 ", + className, + )} + ref={ref} + {...props} + /> + </div> + ); + }, +); +InputWithIcon.displayName = "Input"; + +export { Input, InputWithIcon }; |