Skip to content

Instantly share code, notes, and snippets.

@kolodny
Created August 28, 2015 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kolodny/b77f3e9f405e7997dd8e to your computer and use it in GitHub Desktop.
Save kolodny/b77f3e9f405e7997dd8e to your computer and use it in GitHub Desktop.
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