blob: 68922f39b2d573fc4b93d293fcfc2adc0a55eadc (
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
|
import classNames from 'classnames';
import React from 'react';
export default React.createClass({
propTypes: {
count: React.PropTypes.number.isRequired,
total: React.PropTypes.number.isRequired,
loadMore: React.PropTypes.func
},
canLoadMore() {
return typeof this.props.loadMore === 'function';
},
handleLoadMore(e) {
e.preventDefault();
if (this.canLoadMore()) {
this.props.loadMore();
}
},
renderLoading() {
return <footer className="spacer-top note text-center">
{window.t('loading')}
</footer>;
},
render() {
let hasMore = this.props.total > this.props.count,
loadMoreLink = <a onClick={this.handleLoadMore} className="spacer-left" href="#">show more</a>;
let className = classNames('spacer-top note text-center', { 'new-loading': !this.props.ready });
return (
<footer className={className}>
{this.props.count}/{this.props.total} shown
{this.canLoadMore() && hasMore ? loadMoreLink : null}
</footer>
);
}
});
|