import React from 'react'; import PropTypes from 'prop-types'; import Package from './package'; class PackageSet extends React.Component { static propTypes = { title: PropTypes.string.isRequired, packages: PropTypes.array, emptyText: PropTypes.element, showVersions: PropTypes.bool, }; render() { if (!this.props.packages) return false; const packages = this.props.packages.map(pkg => ( )); let count = ({this.props.packages.length}); if (packages.length === 0) { count = []; packages.push(
{this.props.emptyText || 'No plugins to display.'}
); } return (
{this.props.title} {count}
{packages}
); } } export default PackageSet;