Skip to content

Commit 378a670

Browse files
committed
add login
1 parent 714985f commit 378a670

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

23-add-cart/src/pages/login/index.tsx

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import * as React from 'react'
2+
import Avatar from '@mui/material/Avatar'
3+
import Button from '@mui/material/Button'
4+
import CssBaseline from '@mui/material/CssBaseline'
5+
import TextField from '@mui/material/TextField'
6+
import FormControlLabel from '@mui/material/FormControlLabel'
7+
import Checkbox from '@mui/material/Checkbox'
8+
import Link from '@mui/material/Link'
9+
import Grid from '@mui/material/Grid'
10+
import Box from '@mui/material/Box'
11+
import LockOutlinedIcon from '@mui/icons-material/LockOutlined'
12+
import Typography from '@mui/material/Typography'
13+
import Container from '@mui/material/Container'
14+
import { createTheme, ThemeProvider } from '@mui/material/styles'
15+
16+
export default function Login() {
17+
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
18+
event.preventDefault()
19+
const data = new FormData(event.currentTarget)
20+
console.log({
21+
email: data.get('email'),
22+
password: data.get('password'),
23+
})
24+
}
25+
26+
return (
27+
<Box
28+
sx={{
29+
marginTop: 8,
30+
display: 'flex',
31+
flexDirection: 'column',
32+
alignItems: 'center',
33+
}}
34+
>
35+
<Avatar sx={{ m: 1, bgcolor: 'secondary.main' }}>
36+
<LockOutlinedIcon />
37+
</Avatar>
38+
<Typography component='h1' variant='h5'>
39+
Sign in
40+
</Typography>
41+
<Box component='form' onSubmit={handleSubmit} noValidate sx={{ mt: 1 }}>
42+
<TextField
43+
margin='normal'
44+
required
45+
fullWidth
46+
id='email'
47+
label='Email Address'
48+
name='email'
49+
autoComplete='email'
50+
autoFocus
51+
/>
52+
<TextField
53+
margin='normal'
54+
required
55+
fullWidth
56+
name='password'
57+
label='Password'
58+
type='password'
59+
id='password'
60+
autoComplete='current-password'
61+
/>
62+
<FormControlLabel
63+
control={<Checkbox value='remember' color='primary' />}
64+
label='Remember me'
65+
/>
66+
<Button
67+
type='submit'
68+
fullWidth
69+
variant='contained'
70+
sx={{ mt: 3, mb: 2 }}
71+
>
72+
Sign In
73+
</Button>
74+
<Grid container>
75+
<Grid item xs>
76+
<Link href='#' variant='body2'>
77+
Forgot password?
78+
</Link>
79+
</Grid>
80+
<Grid item>
81+
<Link href='#' variant='body2'>
82+
{"Don't have an account? Sign Up"}
83+
</Link>
84+
</Grid>
85+
</Grid>
86+
</Box>
87+
</Box>
88+
)
89+
}

0 commit comments

Comments
 (0)