PropTypes and refactoring
This commit is contained in:
@@ -1,18 +1,10 @@
|
||||
import React from 'react';
|
||||
import './Dependency.css';
|
||||
import { connect } from 'react-redux';
|
||||
import * as Constants from '../../../constants';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
AllowDownload:
|
||||
state.download.DownloadType !== Constants.INSTALL_TYPES.Dependency &&
|
||||
!state.download.DownloadActive &&
|
||||
!state.install.InstallActive,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)((props) => {
|
||||
const Dependency = (props) => {
|
||||
return (
|
||||
<div className={'Dependency'}>
|
||||
<table width="100%">
|
||||
@@ -41,4 +33,21 @@ export default connect(mapStateToProps)((props) => {
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user