Created
August 28, 2015 17:58
-
-
Save kolodny/b77f3e9f405e7997dd8e 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
import React, { PropTypes } from 'react'; | |
import { inputItem, label } from './styles'; | |
export default React.createClass({ | |
propTypes: { | |
handleLogin: PropTypes.func.isRequired, | |
}, | |
handleLogin(e) { | |
e.preventDefault(); | |
const email = React.findDOMNode(this.refs.email).value; | |
const password = React.findDOMNode(this.refs.password).value; | |
this.props.handleLogin({email, password}); | |
}, | |
render() { | |
return ( | |
<div> | |
<h1>You must be logged in to this app</h1> | |
<form className="form-inline"> | |
<div style={inputItem} className="form-group"> | |
<label style={label} htmlFor="email">Email</label> | |
<input ref="email" type="text" className="form-control" id="email" /> | |
</div> | |
<div style={inputItem} className="form-group"> | |
<label style={label} htmlFor="password">Password</label> | |
<input ref="password" type="text" className="form-control" id="password" /> | |
</div> | |
<button style={inputItem} type="submit" className="btn btn-default" ref="submit" onClick={this.handleLogin}>Login</button> | |
</form> | |
</div> | |
); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment