0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-06 22:40:26 -05:00

chore: remove unnecesary prop

This commit is contained in:
Juan Picado @jotadeveloper 2019-01-11 07:23:09 +01:00
parent 773b2d37a4
commit ce994040d2
No known key found for this signature in database
GPG key ID: 18AC54485952D158
2 changed files with 13 additions and 12 deletions

View file

@ -10,18 +10,14 @@ import classes from './packageList.scss';
export default class PackageList extends React.Component {
static propTypes = {
packages: PropTypes.array,
help: PropTypes.bool,
};
renderPackages = () => {
const { packages } = this.props;
return (
packages.length > 0 ? (
<Fragment>
<h1 className={classes.listTitle}>{'Available Packages'}</h1>
{this.renderList()}
</Fragment>
) : null
<Fragment>
<h1 className={classes.listTitle}>{'Available Packages'}</h1>
{this.renderList()}
</Fragment>
);
}
@ -40,13 +36,18 @@ export default class PackageList extends React.Component {
}
render() {
const { help } = this.props;
return (
<div className={"package-list-items"}>
<div className={classes.pkgContainer}>
{help ? <Help /> : this.renderPackages()}
{this.hasPackages() ? this.renderPackages(): <Help /> }
</div>
</div>
);
}
hasPackages() {
const {packages} = this.props;
return packages.length > 0;
}
}

View file

@ -8,12 +8,12 @@ class Home extends Component {
isUserLoggedIn: PropTypes.bool.isRequired,
packages: PropTypes.array.isRequired,
};
render() {
const { packages } = this.props;
return (
<div className={"container content"}>
<PackageList help={packages.length < 1} packages={packages} />
<PackageList packages={packages} />
</div>
);
}