This repository has been archived on 2025-11-04. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
know-it-all/client/src/components/LoginForm.jsx

55 lines
1.9 KiB
JavaScript

import { Checkbox, FormControlLabel, Typography } from '@mui/material';
import { Link } from 'react-router-dom';
import { Form } from '.';
import { FormSubmit, FormTextField } from './StyledElements';
function Login({ form, handleSubmit, handleChange, handleCheckboxChange, error }) {
return (
<Form text='Login' error={error}>
<form onSubmit={handleSubmit}>
<FormTextField
required
label='Email'
name='email'
onChange={handleChange}
value={form.email}
/>
<FormTextField
required
label='Password'
name='password'
onChange={handleChange}
value={form.password}
other={{ type: 'password' }}
/>
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
}}
>
<FormControlLabel
control={<Checkbox checked={form.remember} />}
labelPlacement='start'
label='Remember me'
name='remember'
onChange={handleCheckboxChange}
/>
</div>
<FormSubmit color='primary' type='submit'>
Login
</FormSubmit>
<Typography variant='body1'>
Dont have an account? <Link to='/register'>Register</Link>
</Typography>
<Typography variant='body1'>
Forgot your password? <Link to='/recover'>Recover Password</Link>
</Typography>
</form>
</Form>
);
}
export default Login;