diff --git a/package.json b/package.json index 3f52c53fc..5817bc436 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "redux-thunk": "2.0.1", "sass-lint": "1.5.1", "sass-loader": "6.0.6", - "scratch-gui": "latest", + "scratch-gui": "develop", "scratchr2_translations": "git://github.com/LLK/scratchr2_translations.git#master", "slick-carousel": "1.6.0", "source-map-support": "0.3.2", diff --git a/src/_colors.scss b/src/_colors.scss index 5ef54a7ce..33c5560c3 100644 --- a/src/_colors.scss +++ b/src/_colors.scss @@ -28,6 +28,7 @@ $ui-coral-dark: hsla(350, 100, 60, 1); // #FF3355 More Blocks tertiary $ui-white: hsla(0, 100%, 100%, 1); //#FFF $ui-white-15percent: hsla(0, 100%, 100%, .15); //#FFF $ui-light-primary: hsl(215, 100, 95); +$ui-light-primary-transparent: hsla(215, 100, 95, 0); $ui-border: hsla(0, 0, 85, 1); //#D9D9D9 diff --git a/src/components/registration/steps.jsx b/src/components/registration/steps.jsx index a1d752f99..f9c0b3b4c 100644 --- a/src/components/registration/steps.jsx +++ b/src/components/registration/steps.jsx @@ -444,18 +444,20 @@ class DemographicsStep extends React.Component { handleChooseGender (name, gender) { this.setState({otherDisabled: gender !== 'other'}); } - handleValidSubmit (formData, reset, invalidate) { + handleValidSubmit (formData) { + return this.props.onNextStep(formData); + } + isValidBirthdate (year, month) { const birthdate = new Date( - formData.user.birth.year, - formData.user.birth.month - 1, + year, + month - 1, 1 ); - if (((Date.now() - birthdate) / (24 * 3600 * 1000 * 365.25)) < this.props.birthOffset) { - return invalidate({ - 'user.birth.year': this.props.intl.formatMessage({id: 'teacherRegistration.validationAge'}) - }); - } - return this.props.onNextStep(formData); + return (((Date.now() - birthdate) / (24 * 3600 * 1000 * 365.25)) >= this.props.birthOffset); + } + birthDateValidator (values) { + const isValid = this.isValidBirthdate(values['user.birth.year'], values['user.birth.month']); + return isValid ? true : this.props.intl.formatMessage({id: 'teacherRegistration.validationAge'}); } render () { const countryOptions = getCountryOptions(this.props.intl, DEFAULT_COUNTRY); @@ -485,6 +487,9 @@ class DemographicsStep extends React.Component { } name="user.birth.month" options={this.getMonthOptions()} + validations={{ + birthDateVal: values => this.birthDateValidator(values) + }} />