scratch-www/src/components/join-flow/join-flow.jsx

69 lines
2.2 KiB
React
Raw Normal View History

const bindAll = require('lodash.bindall');
const defaults = require('lodash.defaultsdeep');
const PropTypes = require('prop-types');
const React = require('react');
const injectIntl = require('../../lib/intl.jsx').injectIntl;
const intlShape = require('../../lib/intl.jsx').intlShape;
const Progression = require('../progression/progression.jsx');
const UsernameStep = require('./username-step.jsx');
const BirthDateStep = require('./birthdate-step.jsx');
2019-07-23 21:21:16 -04:00
const GenderStep = require('./gender-step.jsx');
2019-08-08 00:26:17 -04:00
const CountryStep = require('./country-step.jsx');
const EmailStep = require('./email-step.jsx');
const WelcomeStep = require('./welcome-step.jsx');
/*
eslint-disable react/prefer-stateless-function, react/no-unused-prop-types, no-useless-constructor
*/
class JoinFlow extends React.Component {
constructor (props) {
super(props);
bindAll(this, [
'handleAdvanceStep'
]);
this.state = {
formData: {},
registrationError: null,
step: 0
};
}
handleAdvanceStep (formData) {
formData = formData || {};
this.setState({
step: this.state.step + 1,
formData: defaults({}, formData, this.state.formData)
});
}
render () {
return (
<React.Fragment>
<Progression step={this.state.step}>
<UsernameStep onNextStep={this.handleAdvanceStep} />
<BirthDateStep onNextStep={this.handleAdvanceStep} />
2019-07-23 21:21:16 -04:00
<GenderStep onNextStep={this.handleAdvanceStep} />
2019-08-08 00:26:17 -04:00
<CountryStep onNextStep={this.handleAdvanceStep} />
<EmailStep onNextStep={this.handleAdvanceStep} />
<WelcomeStep
email={this.state.formData.email}
username={this.state.formData.username}
onNextStep={this.handleAdvanceStep}
/>
</Progression>
</React.Fragment>
);
}
}
JoinFlow.propTypes = {
intl: intlShape,
onCompleteRegistration: PropTypes.func
};
module.exports = injectIntl(JoinFlow);
/*
eslint-enable
*/