import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { Trans } from 'react-i18next'; import * as actionCreators from '../../actions/install'; class Controls extends Component { renderPrevButton(step) { switch (step) { case 2: case 3: return ( ); default: return false; } } renderNextButton(step) { switch (step) { case 1: return ( ); case 2: case 3: return ( ); case 4: return ( ); case 5: return ( ); default: return false; } } render() { return (
{this.renderPrevButton(this.props.step)} {this.renderNextButton(this.props.step)}
); } } Controls.propTypes = { step: PropTypes.number.isRequired, nextStep: PropTypes.func, prevStep: PropTypes.func, openDashboard: PropTypes.func, submitting: PropTypes.bool, invalid: PropTypes.bool, pristine: PropTypes.bool, address: PropTypes.string, }; const mapStateToProps = (state) => { const { step } = state.install; const props = { step }; return props; }; export default connect( mapStateToProps, actionCreators, )(Controls);