From 87a83a5604b20550430ef4eefbcd573d309694e2 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 22 Jun 2025 10:02:50 +0200 Subject: Initial commit --- apps/web/src/components/ui/input.tsx | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 apps/web/src/components/ui/input.tsx (limited to 'apps/web/src/components/ui/input.tsx') diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx new file mode 100644 index 00000000..c458e036 --- /dev/null +++ b/apps/web/src/components/ui/input.tsx @@ -0,0 +1,63 @@ +import * as React from "react"; +import { Eye, EyeOff } from "lucide-react"; + +import { cn } from "../../lib/utils"; +import { Button } from "./button"; + +interface InputProps extends React.ComponentProps<"input"> { + showPassword?: boolean; + onShowPasswordChange?: (show: boolean) => void; +} + +const Input = React.forwardRef( + ( + { + className, + type, + showPassword, + onShowPasswordChange, + value = "", + ...props + }, + ref + ) => { + const isPassword = type === "password"; + const showPasswordToggle = isPassword && onShowPasswordChange; + const inputType = isPassword && showPassword ? "text" : type; + + return ( +
+ + {showPasswordToggle && ( + + )} +
+ ); + } +); +Input.displayName = "Input"; + +export { Input }; -- cgit v1.3.1