static-cms/src/backends/test-repo/AuthenticationPage.js

30 lines
627 B
JavaScript
Raw Normal View History

import React from 'react';
export default class AuthenticationPage extends React.Component {
static propTypes = {
onLogin: React.PropTypes.func.isRequired
};
2016-10-03 14:25:27 +02:00
state = { email: '' };
2016-10-03 14:25:27 +02:00
handleLogin = e => {
e.preventDefault();
this.props.onLogin(this.state);
2016-10-03 14:25:27 +02:00
};
2016-10-03 14:25:27 +02:00
handleEmailChange = e => {
this.setState({ email: e.target.value });
2016-10-03 14:25:27 +02:00
};
render() {
return <form onSubmit={this.handleLogin}>
<p>
<label>Your name or email: <input type='text' onChange={this.handleEmailChange}/></label>
</p>
<p>
<button type='submit'>Login</button>
</p>
</form>;
}
}