import React from 'react'; import './Dependency.css'; import * as Constants from '../../../constants'; import PropTypes from 'prop-types'; import {connect} from 'react-redux'; const Dependency = (props) => { return (

{props.name}

{props.AllowDownload ? ( { props.onDownload(); return false; }}> Install ) : ( 'Installing...' )}
); }; const mapStateToProps = (state) => { return { AllowDownload: state.download.DownloadType !== Constants.INSTALL_TYPES.Dependency && !state.download.DownloadActive && !state.install.InstallActive, }; }; Dependency.propTypes = { AllowDownload: PropTypes.bool, name: PropTypes.string.isRequired, onDownload: PropTypes.func.isRequired, }; export default connect(mapStateToProps)(Dependency);