-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
2,705 additions
and
435 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
$width-var: 320px; | ||
|
||
.form { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 700px; | ||
margin: 0 auto 20px; | ||
|
||
&__button { | ||
min-width: 400px !important; | ||
} | ||
|
||
&__title { | ||
margin-bottom: 20px; | ||
} | ||
} | ||
|
||
.register { | ||
display: flex; | ||
justify-content: center; | ||
gap: 20px; | ||
&__button { | ||
text-align: center; | ||
color: #42aa19 !important; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { useState } from 'react'; | ||
import { TextField, Button } from '@mui/material'; | ||
import './AuthForm.scss'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const AuthForm = () => { | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
const [emailError, setEmailError] = useState(false); | ||
const [passwordError, setPasswordError] = useState(false); | ||
|
||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
|
||
setEmailError(false); | ||
setPasswordError(false); | ||
|
||
if (email === '') { | ||
setEmailError(true); | ||
} | ||
|
||
if (password === '') { | ||
setPasswordError(true); | ||
} | ||
|
||
if (email && password) { | ||
setEmail(''); | ||
setPassword(''); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<form className="form" autoComplete="off" onSubmit={handleSubmit}> | ||
<h2 className="form__title">Login Form</h2> | ||
<TextField | ||
label="Email" | ||
onChange={e => setEmail(e.target.value)} | ||
required | ||
variant="outlined" | ||
color="secondary" | ||
type="email" | ||
sx={{ mb: 3 }} | ||
fullWidth | ||
value={email} | ||
error={emailError} | ||
className="form__input" | ||
/> | ||
<TextField | ||
label="Password" | ||
onChange={e => setPassword(e.target.value)} | ||
required | ||
variant="outlined" | ||
color="secondary" | ||
type="password" | ||
value={password} | ||
error={passwordError} | ||
fullWidth | ||
sx={{ mb: 3 }} | ||
className="form__input" | ||
/> | ||
<Button | ||
variant="outlined" | ||
color="secondary" | ||
type="submit" | ||
className="form__button" | ||
> | ||
Login | ||
</Button> | ||
</form> | ||
<small className="register"> | ||
Need an account? | ||
{' '} | ||
<Link | ||
className="register__button" | ||
to="/create-account" | ||
> | ||
Register here | ||
</Link> | ||
</small> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React, { useState } from 'react'; | ||
import { | ||
TextField, Button, Stack, | ||
} from '@mui/material'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const CreateAccount = () => { | ||
const [firstName, setFirstName] = useState(''); | ||
const [lastName, setLastName] = useState(''); | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
|
||
function handleSubmit(event: React.FormEvent<HTMLFormElement>) { | ||
event.preventDefault(); | ||
} | ||
|
||
return ( | ||
<> | ||
<form className="form" onSubmit={handleSubmit} action="POST"> | ||
<h2 className="form__title">Register Form</h2> | ||
<Stack spacing={2} direction="row" sx={{ marginBottom: 4 }}> | ||
<TextField | ||
type="text" | ||
variant="outlined" | ||
color="secondary" | ||
label="First Name" | ||
onChange={e => setFirstName(e.target.value)} | ||
value={firstName} | ||
fullWidth | ||
required | ||
className="form__input" | ||
/> | ||
<TextField | ||
type="text" | ||
variant="outlined" | ||
color="secondary" | ||
label="Last Name" | ||
onChange={e => setLastName(e.target.value)} | ||
value={lastName} | ||
fullWidth | ||
required | ||
className="form__input" | ||
/> | ||
</Stack> | ||
<TextField | ||
type="email" | ||
variant="outlined" | ||
color="secondary" | ||
label="Email" | ||
onChange={e => setEmail(e.target.value)} | ||
value={email} | ||
fullWidth | ||
required | ||
sx={{ mb: 4 }} | ||
className="form__input" | ||
/> | ||
<TextField | ||
type="password" | ||
variant="outlined" | ||
color="secondary" | ||
label="Password" | ||
onChange={e => setPassword(e.target.value)} | ||
value={password} | ||
required | ||
fullWidth | ||
sx={{ mb: 4 }} | ||
className="form__input" | ||
/> | ||
<Button | ||
variant="outlined" | ||
color="secondary" | ||
type="submit" | ||
className="form__button" | ||
> | ||
Register | ||
</Button> | ||
</form> | ||
<small className="register"> | ||
Already have an account? | ||
<Link | ||
className="register__button" | ||
to="/authentication" | ||
> | ||
Login Here | ||
</Link> | ||
</small> | ||
|
||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.