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) { const { nextStep, invalid, pristine, install, ip, port, } = this.props; switch (step) { case 1: return ( ); case 2: case 3: return ( ); case 4: return ( ); case 5: return ( ); default: return false; } } render() { const { install } = this.props; return (
{this.renderPrevButton(install.step)} {this.renderNextButton(install.step)}
); } } Controls.propTypes = { install: PropTypes.object.isRequired, nextStep: PropTypes.func, prevStep: PropTypes.func, openDashboard: PropTypes.func, submitting: PropTypes.bool, invalid: PropTypes.bool, pristine: PropTypes.bool, ip: PropTypes.string, port: PropTypes.number, }; const mapStateToProps = (state) => { const { install } = state; const props = { install }; return props; }; export default connect( mapStateToProps, actionCreators, )(Controls);