2017-06-08 23:15:34 +02:00
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
2017-09-11 03:25:24 +02:00
|
|
|
import { Form, FormRow, Submit } from "component/form.js";
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2017-06-09 02:10:53 +02:00
|
|
|
class UserEmailNew extends React.PureComponent {
|
2017-06-02 02:51:52 +02:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2017-06-08 23:15:34 +02:00
|
|
|
email: "",
|
2017-06-02 02:51:52 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
handleEmailChanged(event) {
|
|
|
|
this.setState({
|
|
|
|
email: event.target.value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-09-11 03:25:24 +02:00
|
|
|
handleSubmit() {
|
|
|
|
const { email } = this.state;
|
|
|
|
this.props.addUserEmail(email);
|
2017-06-02 02:51:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-06-08 23:15:34 +02:00
|
|
|
const { errorMessage, isPending } = this.props;
|
2017-06-02 02:51:52 +02:00
|
|
|
|
2017-06-08 23:15:34 +02:00
|
|
|
return (
|
2017-09-11 03:25:24 +02:00
|
|
|
<Form onSubmit={this.handleSubmit.bind(this)}>
|
2017-08-26 05:21:26 +02:00
|
|
|
<p>
|
|
|
|
{__(
|
|
|
|
"This process is required to prevent abuse of the rewards program."
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
{__(
|
|
|
|
"We will also contact you about updates and new content, but you can unsubscribe at any time."
|
|
|
|
)}
|
|
|
|
</p>
|
2017-06-08 23:15:34 +02:00
|
|
|
<FormRow
|
|
|
|
type="text"
|
|
|
|
label="Email"
|
2017-08-12 19:24:02 +02:00
|
|
|
placeholder="youremail@example.org"
|
2017-06-08 23:15:34 +02:00
|
|
|
name="email"
|
|
|
|
value={this.state.email}
|
|
|
|
errorMessage={errorMessage}
|
|
|
|
onChange={event => {
|
|
|
|
this.handleEmailChanged(event);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<div className="form-row-submit">
|
2017-09-11 03:25:24 +02:00
|
|
|
<Submit label="Next" disabled={isPending} />
|
2017-06-08 23:15:34 +02:00
|
|
|
</div>
|
2017-09-11 03:25:24 +02:00
|
|
|
</Form>
|
2017-06-08 23:15:34 +02:00
|
|
|
);
|
2017-06-02 02:51:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-08 23:15:34 +02:00
|
|
|
export default UserEmailNew;
|