-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoginForm.jsx
More file actions
67 lines (62 loc) · 1.96 KB
/
LoginForm.jsx
File metadata and controls
67 lines (62 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import "./styles.css";
import { useState } from "react";
import { useSelector } from "react-redux";
import InputField from "../../CommonComponents/InputField/InputField";
import ActionButton from "../../CommonComponents/ActionButton/ActionButton";
import useLoginFormService from "../Services/LoginFormService/LoginFormService";
const LoginForm = ({ onClose }) => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const { handleLogin } = useLoginFormService();
const loading = useSelector((state) => state.loading.loadingState);
const onSubmit = (e) => {
e.preventDefault();
handleLogin(email, password);
};
return (
<div className="login-layer">
<div className="login-form">
<div className="login-header">
<h2 className="login-title">Login</h2>
<button className="close-button" onClick={onClose}>
✕
</button>
</div>
<div className="login-content">
{loading ? (
<div className="spinner-container">
<div className="spinner"></div>
</div>
) : (
<>
<InputField
label="Email"
placeholder="Email"
width="70%"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<InputField
label="Password"
placeholder="Password"
type="password"
width="70%"
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
<ActionButton
backgroundColor="#F9A43A"
color="#233A7E"
text={<h3>Login</h3>}
width="70%"
onClick={onSubmit}
margin="5px"
/>
</>
)}
</div>
</div>
</div>
);
};
export default LoginForm;