import { EyeOff, Mail, Phone, Eye, LogIn, Lock, Loader2, CheckCircle } from "lucide-react"; import { useTranslation } from "react-i18next"; import { motion } from "framer-motion"; import Link from "next/link"; import { useState } from "react"; export default function LoginForm({ loginMethod, errors, formData, isLoading, isSuccess, setFormData, handleCredentialChange }) { const { t } = useTranslation(); const [showPassword, setShowPassword] = useState(false); return ( <>
{loginMethod === "email" ? ( ) : ( )}
handleCredentialChange(e.target.value)} className={`w-full pr-12 pl-4 py-4 bg-white/5 border rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500 focus:border-transparent text-amber-50 placeholder-gray-500 transition-all ${ errors.credential ? "border-red-500" : "border-gray-700" }`} placeholder={loginMethod === "email" ? t("emailPlaceholder") : t("phonePlaceholder")} dir="ltr" />
{errors.credential && ( {errors.credential} )}
{/* Password */}
{ setFormData({ ...formData, password: e.target.value, }); if (errors.password) setErrors({ ...errors, password: null }); }} className={`w-full pr-12 pl-12 py-4 bg-white/5 border rounded-xl focus:outline-none focus:ring-2 focus:ring-amber-500 focus:border-transparent text-amber-50 placeholder-gray-500 transition-all ${ errors.password ? "border-red-500" : "border-gray-700" }`} placeholder={t("passwordPlaceholder")} />
{errors.password && ( {errors.password} )}
{/* Remember + Forgot */}
{t("forgotPassword")}
{/* Submit */} {isLoading ? ( <> {t("loggingIn")}{" "} ) : isSuccess ? ( <> {t("success")}{" "} ) : ( <> {" "} {t("login")} )} ); }