FEAT: BorderSpeed Up on Login

This commit is contained in:
EvanLin3141
2025-01-29 23:20:23 +00:00
parent 06234bcac2
commit 92f691b6bd
4 changed files with 13 additions and 6 deletions

View File

@@ -22,6 +22,7 @@
width: 200%;
height: 200%;
animation: border-spin var(--spin-duration) linear infinite;
}
.front-content {

View File

@@ -19,7 +19,7 @@ const AuthModal: React.FC<AuthModalProps> = ({ onClose }) => {
setTimeout(() => {
setSpinDuration("7s");
}, 5000);
}, 3500);
};
return (
@@ -63,7 +63,7 @@ const AuthModal: React.FC<AuthModalProps> = ({ onClose }) => {
Register
</ToggleButton>
</div>
{selectedTab === "Login" ? <LoginForm /> : <RegisterForm onSubmit={handleSubmit}/>}
{selectedTab === "Login" ? <LoginForm onSubmit={handleSubmit} /> : <RegisterForm onSubmit={handleSubmit}/>}
</div>
</div>
</>

View File

@@ -14,7 +14,12 @@ interface FormErrors {
general?: string; // For general authentication errors
}
const LoginForm: React.FC = () => {
//Speed up border animation
interface SubmitProps {
onSubmit: () => void;
}
const LoginForm: React.FC<SubmitProps> = ({ onSubmit }) => {
const { setIsLoggedIn } = useAuth();
const [formData, setFormData] = useState<LoginFormData>({
@@ -46,6 +51,7 @@ const LoginForm: React.FC = () => {
};
const handleSubmit = async (e: React.FormEvent) => {
onSubmit();
e.preventDefault();
if (validateForm()) {
@@ -94,7 +100,7 @@ const LoginForm: React.FC = () => {
<form
onSubmit={handleSubmit}
id="login-form"
className="h-[100%] flex flex-col h-full justify-evenly items-center"
className="h-[100%] flex flex-col justify-evenly items-center"
>
{errors.general && (
<p className="text-red-500 text-sm text-center">{errors.general}</p>

View File

@@ -19,7 +19,7 @@ interface FormErrors {
}
interface SubmitProps {
onSubmit: () => void; // Add the prop for the callback
onSubmit: () => void;
}
const RegisterForm: React.FC<SubmitProps> = ({ onSubmit }) => {
@@ -110,7 +110,7 @@ const RegisterForm: React.FC<SubmitProps> = ({ onSubmit }) => {
<form
onSubmit={handleSubmit}
id="register-form"
className="h-[100%] flex flex-col h-full justify-evenly items-center"
className="h-[100%] flex flex-col justify-evenly items-center"
>
{errors.general && (
<p className="text-red-500 text-sm text-center">{errors.general}</p>