add reset account button

This commit is contained in:
Barry Gitarts 2018-11-17 07:25:00 -05:00
parent 304c0654a5
commit 47edc0343d
1 changed files with 21 additions and 11 deletions

View File

@ -1,10 +1,17 @@
import React from 'react';
import Grid from '@material-ui/core/Grid';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import { Formik } from 'formik';
import { func } from 'prop-types';
const containerStyle = { display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh', width: '50%' };
const containerStyle = {
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-evenly',
height: '100vh',
width: '50%'
};
const Login = ({ setupKeyringController }) => (
<Grid
container
@ -17,7 +24,7 @@ const Login = ({ setupKeyringController }) => (
initialValues={{ password: '' }}
onSubmit={(values, { resetForm }) => {
const { password } = values;
setupKeyringController(password)
setupKeyringController(password);
resetForm();
}}
>
@ -27,14 +34,14 @@ const Login = ({ setupKeyringController }) => (
touched,
handleChange,
handleBlur,
handleSubmit,
handleSubmit
}) => (
<form onSubmit={handleSubmit} style={containerStyle}>
<TextField
id="password"
type="password"
name="password"
label="Enter your password"
label="Enter your password to login"
variant="outlined"
fullWidth
value={values.password}
@ -42,14 +49,17 @@ const Login = ({ setupKeyringController }) => (
onChange={handleChange}
/>
{errors.password && touched.password && errors.password}
<Button size="large" variant="outlined" color="secondary">
RESET ACCOUNT
</Button>
</form>
)}
</Formik>
</Grid>
)
);
Login.propTypes = {
setupKeyringController: func.isRequired
}
};
export default Login;