diff --git a/client/src/components/PasswordInput.jsx b/client/src/components/PasswordInput.jsx new file mode 100644 index 00000000..b3e10dd6 --- /dev/null +++ b/client/src/components/PasswordInput.jsx @@ -0,0 +1,76 @@ +import React, { useState } from 'react'; + +const PasswordInput = ({ + value, + onChange, + placeholder = "Password", + name = "password", + required = true, + className = "p-3 border border-gray-300 rounded text-gray-900 placeholder-gray-400" +}) => { + const [showPassword, setShowPassword] = useState(false); + + const togglePasswordVisibility = () => { + setShowPassword(!showPassword); + }; + + return ( +
+ + +
+ ); +}; + +export default PasswordInput; diff --git a/client/src/pages/LoginPage.jsx b/client/src/pages/LoginPage.jsx index 5352e767..983d80b7 100644 --- a/client/src/pages/LoginPage.jsx +++ b/client/src/pages/LoginPage.jsx @@ -1,5 +1,6 @@ import React, { useState, useContext } from "react"; import { useNavigate, Link } from "react-router-dom"; +import PasswordInput from "../components/PasswordInput"; import { ThemeContext } from "../context/ThemeContext"; import AnimatedBackground from "../components/AnimatedBackground"; @@ -67,13 +68,10 @@ function LoginPage() { required className="p-3 border border-gray-300 dark:border-gray-600 rounded text-gray-900 dark:text-gray-100 placeholder-gray-400 bg-white/80 dark:bg-gray-700/80 backdrop-blur-sm" /> - setPassword(e.target.value)} - required - className="p-3 border border-gray-300 dark:border-gray-600 rounded text-gray-900 dark:text-gray-100 placeholder-gray-400 bg-white/80 dark:bg-gray-700/80 backdrop-blur-sm" + placeholder="Password" /> {error &&

{error}

}