2016-03-17 17:48:25 +09:00
|
|
|
const CommentList = ({results, currentUser, hasMore, ready, count, totalCount, loadMore}) => {
|
2016-02-16 16:12:13 +09:00
|
|
|
|
2016-02-18 17:53:04 +09:00
|
|
|
({LoadMore, PostsLoading, NoPosts, NoMorePosts, CommentNode} = Telescope.components);
|
|
|
|
|
2016-03-17 17:48:25 +09:00
|
|
|
if (!!results.length) {
|
2016-02-16 16:12:13 +09:00
|
|
|
return (
|
|
|
|
<div className="commentList">
|
2016-03-17 17:48:25 +09:00
|
|
|
{results.map(comment => <CommentNode comment={comment} key={comment._id} currentUser={currentUser}/>)}
|
|
|
|
{hasMore ? (ready ? <LoadMore loadMore={loadMore} count={count} totalCount={totalCount} /> : <PostsLoading/>) : <NoMorePosts/>}
|
2016-02-16 16:12:13 +09:00
|
|
|
</div>
|
|
|
|
)
|
2016-03-17 17:48:25 +09:00
|
|
|
} else if (!ready) {
|
2016-02-16 16:12:13 +09:00
|
|
|
return (
|
|
|
|
<div className="commentList">
|
|
|
|
<PostsLoading/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<div className="commentList">
|
|
|
|
<NoPosts/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = CommentList;
|