From f0fe43970f314808a7bf2685a148cb17e8ed430b Mon Sep 17 00:00:00 2001 From: jaswanthshakthi <jaswanthshakthi@gmail.com> Date: Sun, 16 Mar 2025 01:53:33 +0530 Subject: [PATCH] some changes --- .gitignore | 2 +- src/components2/AdminLogin2/AdminLogin.jsx | 132 -------------------- src/components2/AdminLogin2/AdminLogin3.jsx | 124 ------------------ 3 files changed, 1 insertion(+), 257 deletions(-) delete mode 100644 src/components2/AdminLogin2/AdminLogin.jsx delete mode 100644 src/components2/AdminLogin2/AdminLogin3.jsx diff --git a/.gitignore b/.gitignore index e4b8f71..692d535 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,6 @@ dist-ssr *.sln *.sw? -src/components2/AdminLogin2/AdminLogin2.jsx +src/components2/AdminLogin2/AdminLogin.jsx src/components2/AdminLogin2/AdminLogin3.jsx \ No newline at end of file diff --git a/src/components2/AdminLogin2/AdminLogin.jsx b/src/components2/AdminLogin2/AdminLogin.jsx deleted file mode 100644 index b2d44b8..0000000 --- a/src/components2/AdminLogin2/AdminLogin.jsx +++ /dev/null @@ -1,132 +0,0 @@ -import { useState } from "react"; -import { FiMail, FiEye, FiEyeOff } from "react-icons/fi"; - -const loginImage = new URL("/public/assets/img/loginadmin.svg", import.meta.url).href; - -function AdminLoginForm() { - const [adminId, setAdminId] = useState(""); - const [password, setPassword] = useState(""); - const [showPassword, setShowPassword] = useState(false); - const [error, setError] = useState({ adminId: "", password: "", general: "" }); - - const validateMerchantId = (id) => /^[A-Z]{4}[0-9]{5}$/.test(id); - const validatePassword = (pass) => pass.length >= 8; - - const handleSubmit = (e) => { - e.preventDefault(); - let newErrors = { adminId: "", password: "", general: "" }; - - if (!validateMerchantId(adminId)) { - newErrors.adminId = "Merchant ID must be 4 uppercase letters followed by 5 digits."; - } - if (!validatePassword(password)) { - newErrors.password = "Password must be at least 8 characters long."; - } - - if (newErrors.adminId || newErrors.password) { - newErrors.general = "*Incorrect Email or Password !"; - setError(newErrors); - return; - } - - setError({ adminId: "", password: "", general: "" }); - - alert("Login Successful!"); - }; - - return ( - <div className="w-full md:w-1/2 flex flex-col items-center justify-center p-8 text-[#6FE7D1] h-full flex-grow"> - <h2 className="text-4xl md:text-5xl font-font-primary font-semibold text-[#6FE7D1] mb-12"> - Admin Login - </h2> - - <form onSubmit={handleSubmit} className="w-full max-w-sm space-y-8"> - <div className="relative"> - <label className={`absolute -top-3 left-4 px-2 bg-[#1E1E1E] border rounded-md text-sm font-medium - ${error.adminId ? "border-[#EEAB4D] text-[#EEAB4D]" : "border-[#6FE7D1] text-[#6FE7D1]"}`}> - Admin ID - </label> - <input - type="text" - value={adminId} - onChange={(e) => setAdminId(e.target.value)} - placeholder="Enter ID" - className={`w-full h-14 px-4 pr-10 border-2 rounded-lg bg-transparent text-white text-lg shadow-sm focus:outline-none - ${error.adminId ? "border-[#EEAB4D] text-[#EEAB4D]" : "border-[#6FE7D1] text-white"}`} - /> - <FiMail - className="absolute right-4 top-1/2 transform -translate-y-1/2 text-xl transition-colors duration-200" - style={{ color: error.adminId ? "#EEAB4D" : "#6FE7D1" }} - /> - </div> - - <div className="relative"> - <label className={`absolute -top-3 left-4 px-2 bg-[#1E1E1E] border rounded-md text-sm font-medium - ${error.password ? "border-[#EEAB4D] text-[#EEAB4D]" : "border-[#6FE7D1] text-[#6FE7D1]"}`}> - Password - </label> - <input - type={showPassword ? "text" : "password"} - value={password} - onChange={(e) => setPassword(e.target.value)} - placeholder="Enter your password" - className={`w-full h-14 px-4 pr-10 border-2 rounded-lg bg-transparent text-white text-lg shadow-sm focus:outline-none - ${error.password ? "border-[#EEAB4D] text-[#EEAB4D]" : "border-[#6FE7D1] text-white"}`} - /> - {showPassword ? ( - <FiEyeOff - className="absolute right-4 top-1/2 transform -translate-y-1/2 text-xl transition-colors duration-200 cursor-pointer" - style={{ color: error.password ? "#EEAB4D" : "#6FE7D1" }} - onClick={() => setShowPassword(!showPassword)} - /> - ) : ( - <FiEye - className="absolute right-4 top-1/2 transform -translate-y-1/2 text-xl transition-colors duration-200 cursor-pointer" - style={{ color: error.password ? "#EEAB4D" : "#6FE7D1" }} - onClick={() => setShowPassword(!showPassword)} - /> - )} - </div> - - <div className="flex justify-between items-center"> - <a href="#" className="text-[#6FE7D1] hover:underline text-sm font-semibold"> - Forgot Password? - </a> - {error.general && ( - <span className="text-[#EEAB4D] text-sm font-semibold"> - {error.general} - </span> - )} - </div> - - <div className="mt-8 flex justify-center"> - <button - type="submit" - className="w-48 h-14 text-black font-semibold rounded-full bg-[#6FE7D1] shadow-md hover:bg-[#5CC4AE] transition text-lg"> - Sign In - </button> - </div> - </form> - </div> - ); -} - -export default function AdminLogin() { - return ( - <div className="flex flex-col items-center justify-center h-screen bg-[#D9F6F0] px-6 py-4"> - <h1 className="text-4xl font-font-primary font-semibold text-[#0C4339] mb-6 text-left w-full max-w-[90%]"> - OMPOI - Admin - </h1> - - <div className="bg-[#1E1E1E] p-6 rounded-lg shadow-lg w-[90%] h-[90%] flex flex-col md:flex-row py-12"> - <div className="hidden md:flex w-1/2 items-center justify-center p-4 min-w-[300px]"> - <img src={loginImage} alt="Login" className="w-[80%] lg:w-[80%] xl:w-[80%]" /> - </div> - - <div className="w-[1px] bg-gray-600 hidden md:block"></div> - - <AdminLoginForm /> - </div> - </div> - ); -} diff --git a/src/components2/AdminLogin2/AdminLogin3.jsx b/src/components2/AdminLogin2/AdminLogin3.jsx deleted file mode 100644 index 9b3a23e..0000000 --- a/src/components2/AdminLogin2/AdminLogin3.jsx +++ /dev/null @@ -1,124 +0,0 @@ -import { useState } from "react"; -import { FiMail, FiEye, FiEyeOff } from "react-icons/fi"; - -const loginImage = new URL("/assets/img/loginadmin.svg", import.meta.url).href; // Adjusted path - -export default function AdminLogin() { - const [adminId, setAdminId] = useState(""); - const [password, setPassword] = useState(""); - const [showPassword, setShowPassword] = useState(false); - const [error, setError] = useState({ adminId: "", password: "" }); - - const validateMerchantId = (id) => /^[A-Z]{4}[0-9]{5}$/.test(id); - const validatePassword = (pass) => pass.length >= 8; - - const handleSubmit = (e) => { - e.preventDefault(); - - let newErrors = { adminId: "", password: "" }; - - if (!validateMerchantId(adminId)) { - newErrors.adminId = "Merchant ID must be 4 uppercase letters followed by 5 digits."; - } - if (!validatePassword(password)) { - newErrors.password = "Password must be at least 8 characters long."; - } - - setError(newErrors); - - if (!newErrors.adminId && !newErrors.password) { - // Simulate a successful login - alert("Login Successful!"); - // Here you would typically handle the login logic (e.g., API call) - } - }; - - return ( - <div className="flex items-center justify-center h-screen bg-[#D9F6F0] overflow-hidden"> - <div className="bg-[#1E1E1E] w-[70%] h-[70%] p-6 rounded-lg shadow-lg flex"> {/* Adjusted width and height */} - - {/* Left Side - Image */} - <div className="w-1/2 flex items-center justify-center p-6 hidden md:flex"> - <img src={loginImage} alt="Login" className="w-[90%] lg:w-[110%] xl:w-[130%]" /> - </div> - - {/* Divider */} - <div className="w-[1px] bg-gray-600"></div> - - {/* Right Side - Login Form */} - <div className="w-1/2 flex flex-col items-center justify-center p-6 text-[#6FE7D1]"> - <h2 className="text-4xl md:text-5xl font-primary font-semibold text-[#6FE7D1] mb-6 whitespace-nowrap"> - Admin Login - </h2> - - <form onSubmit={handleSubmit} className="w-full max-w-md"> - {/* Admin ID Input */} - <div className="relative mt-6"> - <label className="absolute -top-3 left-4 px-2 text-[#6FE7D1] text-lg font-semibold bg-[#1E1E1E] border border-[#6FE7D1] rounded-md"> - Admin ID - </label> - <input - type="text" - value={adminId} - onChange={(e) => setAdminId(e.target.value)} - placeholder="Enter ID" - className={`w-full h-[60px] px-4 py-2 pr-12 border-2 rounded-lg bg-transparent text-white text-lg focus:outline-none - ${error.adminId ? "border-red-500" : "border-[#6FE7D1]"}`} - aria-invalid={!!error.adminId} - aria-describedby="adminIdError" - /> - <FiMail className="absolute right-4 top-1/2 transform -translate-y-1/2 text-2xl text-[#6FE7D1]" /> - {error.adminId && <p id="adminIdError" className="text-red-500 text-sm mt-1">{error.adminId}</p>} - </div> - - {/* Password Input */} - <div className="relative mt-6"> - <label className="absolute -top-3 left-4 px-2 text-[#6FE7D1] text-lg font-semibold bg-[#1E1E1E] border border-[#6FE7D1] rounded-md"> - Password - </label> - <input - type={showPassword ? "text" : "password"} - value={password} - onChange={(e) => setPassword(e.target.value)} - placeholder="Enter your password" - className={`w-full h-[60px] px-4 py-2 pr-12 border-2 rounded-lg bg-transparent text-white text-lg focus:outline-none - ${error.password ? "border-red-500" : "border-[#6FE7D1]"}`} - aria-invalid={!!error.password} - aria-describedby="passwordError" - /> - {showPassword ? ( - <FiEyeOff - className="absolute right-4 top-1/2 transform -translate-y-1/2 text-2xl text-[#6FE7D1] cursor-pointer" - onClick={() => setShowPassword(!showPassword)} - /> - ) : ( - <FiEye - className="absolute right-4 top-1/2 transform -translate-y-1/2 text-2xl text-[#6FE7D1] cursor-pointer" - onClick={() => setShowPassword(!showPassword)} - /> - )} - {error.password && <p id="passwordError" className="text-red-500 text-sm mt-1">{error.password}</p>} - </div> - - {/* Forgot Password Link */} - <div className="text-left mt-4"> - <a href="#" className="text-[#6FE7D1] hover:underline text-sm font-semibold"> - Forgot Password? - </a> - </div> - - {/* Sign In Button */} - <div className="mt-8 flex justify-center"> - <button - type="submit" - className="w-[200px] h-[55px] text-black font-semibold rounded-full bg-[#6FE7D1] shadow-md hover:bg-[#5CC4AE] transition text-lg" - > - Sign In - </button> - </div> - </form> - </div> - </div> - </div> - ); -} \ No newline at end of file -- GitLab