mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-25 01:36:06 +08:00
Summary: Adds new redesigned preferences with horizontal tab bar and refactored code. Converts Preferences, Plugins, and a few components to ES6. Test Plan: Tested locally. Reviewers: evan, bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D2818
40 lines
850 B
JavaScript
40 lines
850 B
JavaScript
import React from 'react';
|
|
|
|
import Package from './package';
|
|
|
|
|
|
class PackageSet extends React.Component {
|
|
|
|
static propTypes = {
|
|
title: React.PropTypes.string.isRequired,
|
|
packages: React.PropTypes.array.isRequired,
|
|
emptyText: React.PropTypes.element,
|
|
}
|
|
|
|
render() {
|
|
if (!this.props.packages) return false;
|
|
|
|
const packages = this.props.packages.map((pkg) =>
|
|
<Package key={pkg.name} package={pkg} />
|
|
);
|
|
let count = <span>({this.props.packages.length})</span>
|
|
|
|
if (packages.length === 0) {
|
|
count = [];
|
|
packages.push(
|
|
<div key="empty" className="empty">{this.props.emptyText || "No plugins to display."}</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className="package-set">
|
|
<h6>{this.props.title} {count}</h6>
|
|
{packages}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
export default PackageSet;
|