aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src/components/ui
diff options
context:
space:
mode:
authorYash <[email protected]>2024-04-02 11:36:40 +0000
committerYash <[email protected]>2024-04-02 11:36:40 +0000
commit90eb9429fde5f06f08fed31531fefe6f1ebf75a5 (patch)
treecb19cd6bade52c106ba2a3d8afb32508b538cf61 /apps/web/src/components/ui
parentresponsiveness (diff)
downloadsupermemory-90eb9429fde5f06f08fed31531fefe6f1ebf75a5.tar.xz
supermemory-90eb9429fde5f06f08fed31531fefe6f1ebf75a5.zip
input with icon
Diffstat (limited to 'apps/web/src/components/ui')
-rw-r--r--apps/web/src/components/ui/input.tsx28
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 };