code (10)
code (10)
return (
<Box sx={{ maxWidth: 400, margin: '0 auto', paddingTop: 3 }}>
<Formik
initialValues={initialValues}
validationSchema={LoginSchema}
onSubmit={handleSubmit}
>
{({ isSubmitting, values, handleChange, touched, errors }) => (
<Form>
<Box mb={2}>
<TextField
label="Email"
fullWidth
type="email"
name="email"
value={values.email}
onChange={handleChange}
error={touched.email && !!errors.email}
helperText={touched.email && errors.email}
/>
</Box>
<Box mb={2}>
<TextField
label="Password"
fullWidth
type="password"
name="password"
value={values.password}
onChange={handleChange}
error={touched.password && !!errors.password}
helperText={touched.password && errors.password}
/>
</Box>
<Button type="submit"
variant="contained"
color="primary"
disabled={isSubmitting}
>
{isSubmitting ? 'Logging in...' : 'Login'}
</Button>
</Form>
)}
</Formik>
</Box>
);