Last active
October 17, 2017 11:29
-
-
Save souhe/696d1c9458c359862609790ecc84e14e to your computer and use it in GitHub Desktop.
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
/* @flow */ | |
import React, { Component } from 'react'; | |
... | |
type State = { | |
passwordVisable: boolean, | |
email: string, | |
password: string, | |
loginPending: boolean | |
}; | |
type Props = { | |
history: Object, | |
match: Object, | |
login: ({ email: string, password: string }) => Promise<*>, | |
googleLogin: ({ googleToken: string }) => Promise<*> | |
}; | |
class LoginForm extends Component<Props, State> { | |
... | |
render() { | |
const { match } = this.props; | |
const { | |
passwordVisable, | |
email, | |
password, | |
loginPending | |
} = this.state; | |
return ( | |
<Container> | |
<HeaderContainer> | |
<H3 fontFamily="bold">Log in to your account</H3> | |
<br /> | |
<P fontFamily="medium"> | |
You can use your Diagnostic Questions credentials :) | |
</P> | |
</HeaderContainer> | |
<form onSubmit={e => this.handleLogin(validate, e)}> | |
<Input | |
underline | |
value={email} | |
onChange={e => this.handleChange('email', e)} | |
placeholder="Email / username" | |
autoFocus | |
/> | |
<Input | |
underline | |
value={password} | |
onChange={e => this.handleChange('password', e)} | |
type={passwordVisable ? 'text' : 'password'} | |
placeholder="Password" | |
iconName={passwordVisable ? 'eyeOn' : 'eyeOff'} | |
onIconClick={() => | |
this.setState(state => ({ | |
passwordVisable: !state.passwordVisable | |
}))} | |
/> | |
<FooterContainer> | |
<ForgotLink | |
onClick={() => { | |
this.props.history.push(`${match.url}/forgot-password`); | |
}} | |
> | |
<TextS color="gray5">I forgot my password</TextS> | |
</ForgotLink> | |
<Container> | |
<Button | |
type="submit" | |
onClick={e => this.handleLogin(validate, e)} | |
loading={loginPending} | |
> | |
Log in | |
</Button> | |
</Container> | |
</FooterContainer> | |
</form> | |
</Container> | |
); | |
} | |
} | |
... | |
export default LoginForm; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment