diff --git a/src/components/formik-forms/formik-select.jsx b/src/components/formik-forms/formik-select.jsx index dcd631012..5ec1bcdf5 100644 --- a/src/components/formik-forms/formik-select.jsx +++ b/src/components/formik-forms/formik-select.jsx @@ -24,10 +24,9 @@ const FormikSelect = ({ )); return ( -
+
([ + {value: 'null', label: intl.formatMessage({id: 'general.month'})}, + {value: '1', label: intl.formatMessage({id: 'general.monthJanuary'})}, + {value: '2', label: intl.formatMessage({id: 'general.monthFebruary'})}, + {value: '3', label: intl.formatMessage({id: 'general.monthMarch'})}, + {value: '4', label: intl.formatMessage({id: 'general.monthApril'})}, + {value: '5', label: intl.formatMessage({id: 'general.monthMay'})}, + {value: '6', label: intl.formatMessage({id: 'general.monthJune'})}, + {value: '7', label: intl.formatMessage({id: 'general.monthJuly'})}, + {value: '8', label: intl.formatMessage({id: 'general.monthAugust'})}, + {value: '9', label: intl.formatMessage({id: 'general.monthSeptember'})}, + {value: '10', label: intl.formatMessage({id: 'general.monthOctober'})}, + {value: '11', label: intl.formatMessage({id: 'general.monthNovember'})}, + {value: '12', label: intl.formatMessage({id: 'general.monthDecember'})} +]); + +const getBirthYearOptions = intl => { + const curYearRaw = (new Date()).getYear(); + const curYear = curYearRaw + 1900; + // including both 1900 and current year, there are (curYearRaw + 1) options. + const numYearOptions = curYearRaw + 1; + const birthYearOptions = Array(numYearOptions).fill() + .map((defaultVal, i) => ( + {value: String(curYear - i), label: String(curYear - i)} + )); + birthYearOptions.unshift({ + value: 'null', + label: intl.formatMessage({id: 'general.year'}) + }); + return birthYearOptions; +}; + +class BirthDateStep extends React.Component { + constructor (props) { + super(props); + bindAll(this, [ + 'handleValidSubmit', + 'validateForm', + 'validateSelect' + ]); + } + validateSelect (selection) { + if (selection === 'null') { + return this.props.intl.formatMessage({id: 'form.validationRequired'}); + } + return null; + } + validateForm () { + return {}; + } + handleValidSubmit (formData, formikBag) { + formikBag.setSubmitting(false); + this.props.onNextStep(formData); + } + render () { + const birthMonthOptions = getBirthMonthOptions(this.props.intl); + const birthYearOptions = getBirthYearOptions(this.props.intl); + return ( + + {props => { + const { + errors, + handleSubmit, + isSubmitting + } = props; + return ( + +
+ + +
+
+ ); + }} +
+ ); + } +} + +BirthDateStep.propTypes = { + intl: intlShape, + onNextStep: PropTypes.func +}; + +const IntlBirthDateStep = injectIntl(BirthDateStep); + +module.exports = IntlBirthDateStep; diff --git a/src/components/join-flow/join-flow-step.jsx b/src/components/join-flow/join-flow-step.jsx index 6ce43ac83..6b1b91fe1 100644 --- a/src/components/join-flow/join-flow-step.jsx +++ b/src/components/join-flow/join-flow-step.jsx @@ -10,11 +10,17 @@ require('./join-flow-step.scss'); const JoinFlowStep = ({ children, description, + headerImgSrc, onSubmit, title, waiting }) => (
+ {headerImgSrc && ( +
+ +
+ )}
{title && ( @@ -38,6 +44,7 @@ const JoinFlowStep = ({ JoinFlowStep.propTypes = { children: PropTypes.node, description: PropTypes.string, + headerImgSrc: PropTypes.string, onSubmit: PropTypes.func, title: PropTypes.string, waiting: PropTypes.bool diff --git a/src/components/join-flow/join-flow-step.scss b/src/components/join-flow/join-flow-step.scss index eeddbf87c..499646956 100644 --- a/src/components/join-flow/join-flow-step.scss +++ b/src/components/join-flow/join-flow-step.scss @@ -21,3 +21,13 @@ padding: 2.3125rem 0 2.5rem; font-size: .875rem; } + +/* overflow will only work if this class is set on parent of img, not img itself */ +.join-flow-header-image { + width: 100%; + height: 7.5rem; + overflow: hidden; + margin: 0; + border-top-left-radius: 1rem; + border-top-right-radius: 1rem; +} diff --git a/src/components/join-flow/join-flow-steps.scss b/src/components/join-flow/join-flow-steps.scss index 7b7e42fd9..a56ff467f 100644 --- a/src/components/join-flow/join-flow-steps.scss +++ b/src/components/join-flow/join-flow-steps.scss @@ -22,6 +22,19 @@ transform: translate(21.5625rem, 0); } +select.join-flow-select { + width: 9.125rem; +} + +.join-flow-select-month { + margin-right: .5rem; +} + .join-flow-password-section { margin-top: 1.125rem; } + +.birthdate-select-row { + display: flex; + margin: 0 auto; +} diff --git a/src/components/join-flow/join-flow.jsx b/src/components/join-flow/join-flow.jsx index ba80726a7..efa663abd 100644 --- a/src/components/join-flow/join-flow.jsx +++ b/src/components/join-flow/join-flow.jsx @@ -7,7 +7,8 @@ const injectIntl = require('../../lib/intl.jsx').injectIntl; const intlShape = require('../../lib/intl.jsx').intlShape; const Progression = require('../progression/progression.jsx'); -const JoinFlowSteps = require('./join-flow-steps.jsx'); +const UsernameStep = require('./username-step.jsx'); +const BirthDateStep = require('./birthdate-step.jsx'); /* eslint-disable react/prefer-stateless-function, react/no-unused-prop-types, no-useless-constructor @@ -35,9 +36,8 @@ class JoinFlow extends React.Component { return ( - + + ); diff --git a/src/components/join-flow/join-flow-steps.jsx b/src/components/join-flow/username-step.jsx similarity index 98% rename from src/components/join-flow/join-flow-steps.jsx rename to src/components/join-flow/username-step.jsx index c612853cd..2d0a8bb49 100644 --- a/src/components/join-flow/join-flow-steps.jsx +++ b/src/components/join-flow/username-step.jsx @@ -1,4 +1,3 @@ -/* eslint-disable react/no-multi-comp */ const bindAll = require('lodash.bindall'); const classNames = require('classnames'); const React = require('react'); @@ -190,11 +189,12 @@ class UsernameStep extends React.Component { ); } } -/* eslint-enable */ UsernameStep.propTypes = { intl: intlShape, onNextStep: PropTypes.func }; -module.exports.UsernameStep = injectIntl(UsernameStep); +const IntlUsernameStep = injectIntl(UsernameStep); + +module.exports = IntlUsernameStep;