frontend/src/pages/SignIn.jsx

73 lines
1.7 KiB
React
Raw Normal View History

2025-04-16 12:02:42 -07:00
import React from "react";
import "@fortawesome/fontawesome-free/css/all.min.css";
function SignInForm() {
const [state, setState] = React.useState({
email: "",
password: "",
});
const handleChange = (evt) => {
const value = evt.target.value;
setState({
...state,
[evt.target.name]: value,
});
};
2025-04-21 17:14:56 -07:00
const googleAuth = () => {
window.open("https://byte-camp-auth-service.fly.dev/auth/google", "_self");
};
2025-04-16 12:02:42 -07:00
const handleOnSubmit = (evt) => {
evt.preventDefault();
const { email, password } = state;
alert(`You are login with email: ${email} and password: ${password}`);
for (const key in state) {
setState({
...state,
[key]: "",
});
}
};
return (
<div className="form-container sign-in-container">
<form onSubmit={handleOnSubmit}>
<h1>Sign in</h1>
<div className="social-container">
2025-04-21 17:14:56 -07:00
<a className="social" onClick={googleAuth}>
<i className="fab fa-google-plus-g" />
2025-04-16 12:02:42 -07:00
</a>
<a href="#" className="social">
2025-04-21 17:14:56 -07:00
<i className="fab fa-facebook-f" />
2025-04-16 12:02:42 -07:00
</a>
<a href="#" className="social">
<i className="fab fa-linkedin-in" />
</a>
</div>
<span>or use your account</span>
<input
type="email"
placeholder="Email"
name="email"
value={state.email}
onChange={handleChange}
/>
<input
type="password"
name="password"
placeholder="Password"
value={state.password}
onChange={handleChange}
/>
<a href="#">Forgot your password?</a>
<button>Sign In</button>
</form>
</div>
);
}
export default SignInForm;