import styles from "./Input.module.css"; import { useState, ChangeEvent, InputHTMLAttributes } from "react"; interface TextInputProps extends InputHTMLAttributes { placeholder?: string; value?: string; onChange?: (e: ChangeEvent) => void; borderStyle?: "square" | "rounded"; password?: boolean; className?: string; } const TextInput = ({ placeholder = "", onChange, value = "", borderStyle = "square", password = false, className = "", ...props }: TextInputProps) => { const [showPassword, setShowPassword] = useState(false); let inputBorderStyle = styles.square; if (borderStyle === "rounded") inputBorderStyle = styles.rounded; const toggleShowPassword = () => { setShowPassword((prev) => !prev); }; if (password) { return (
); } return ( ); }; export default TextInput;