mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 13:44:41 +08:00
26 lines
713 B
CoffeeScript
26 lines
713 B
CoffeeScript
React = require 'react'
|
|
Package = require './package'
|
|
|
|
class PackageSet extends React.Component
|
|
@propTypes:
|
|
'title': React.PropTypes.string.isRequired
|
|
'packages': React.PropTypes.array.isRequired
|
|
'emptyText': React.PropTypes.string
|
|
|
|
render: ->
|
|
return false unless @props.packages
|
|
packages = @props.packages.map (pkg) -> <Package package={pkg} />
|
|
count = <span>({@props.packages.length})</span>
|
|
|
|
if packages.length is 0
|
|
count = []
|
|
packages.push(
|
|
<div className="empty">{@props.emptyText ? "No packages to display."}</div>
|
|
)
|
|
|
|
<div className="package-set">
|
|
<h2>{@props.title} {count}</h2>
|
|
{ packages }
|
|
</div>
|
|
|
|
module.exports = PackageSet
|