import React, { Component, PropTypes } from 'react'; import { FormattedMessage as Message } from 'react-intl'; import { Link } from 'react-router'; import classNames from 'classnames'; import Helmet from 'react-helmet'; import { Motion, spring } from 'react-motion'; import { Input, Button, Form, FormModel } from 'components/ui/form'; import styles from 'components/profile/profileForm.scss'; import helpLinks from 'components/auth/helpLinks.scss'; import MeasureHeight from 'components/MeasureHeight'; import changeEmail from './changeEmail.scss'; import messages from './ChangeEmail.messages'; const STEPS_TOTAL = 3; // TODO: disable code field, if the code was passed through url export default class ChangeEmail extends Component { static displayName = 'ChangeEmail'; static propTypes = { email: PropTypes.string.isRequired, form: PropTypes.instanceOf(FormModel), onChange: PropTypes.func.isRequired, onSubmit: PropTypes.func.isRequired }; static get defaultProps() { return { form: new FormModel() }; } state = { activeStep: 0 }; render() { const {form} = this.props; const {activeStep} = this.state; return (
); } renderStepForms() { const {form, email} = this.props; const {activeStep} = this.state; const activeStepHeight = this.state[`step${activeStep}Height`] || 0; // a hack to disable height animation on first render const isHeightMeasured = this.isHeightMeasured; this.isHeightMeasured = isHeightMeasured || activeStepHeight > 0; return (