blob: 91da5b747bbb7c6410c5a94c183e31678f8e6f0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import React from 'react';
export default {
propTypes: {
permission: React.PropTypes.object.isRequired,
max: React.PropTypes.number.isRequired,
items: React.PropTypes.array,
total: React.PropTypes.number,
refresh: React.PropTypes.func.isRequired
},
renderNotDisplayed() {
const notDisplayedCount = this.props.total - this.props.max;
return notDisplayedCount > 0 ? <span className="note spacer-right" href="#">and {notDisplayedCount} more</span> : null;
},
renderItems() {
const displayed = this.props.items.map(item => {
return <li key={item.name} className="spacer-left little-spacer-bottom">{this.renderItem(item)}</li>;
});
return (
<ul className="overflow-hidden bordered-left">
{displayed}
<li className="spacer-left little-spacer-bottom">
{this.renderNotDisplayed()}
{this.renderUpdateLink()}
</li>
</ul>
);
},
renderCount() {
return (
<ul className="overflow-hidden bordered-left">
<li className="spacer-left little-spacer-bottom">
<span className="spacer-right">{this.props.total}</span>
{this.renderUpdateLink()}
</li>
</ul>
);
},
render() {
return (
<li className="abs-width-400">
<div className="pull-left spacer-right">
<strong>{this.renderTitle()}</strong>
</div>
{this.props.items ? this.renderItems() : this.renderCount()}
</li>
);
}
};
|