2016-04-14 10:12:35 +09:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
const CommentsList = ({results, currentUser, hasMore, ready, count, totalCount, loadMore}) => {
|
|
|
|
|
|
|
|
if (!!results.length) {
|
|
|
|
return (
|
|
|
|
<div className="comments-list">
|
2016-05-22 16:42:24 +09:00
|
|
|
{results.map(comment => <Telescope.components.CommentsNode comment={comment} key={comment._id} currentUser={currentUser}/>)}
|
|
|
|
{hasMore ? (ready ? <Telescope.components.CommentsLoadMore loadMore={loadMore} count={count} totalCount={totalCount} /> : <Telescope.components.Loading/>) : null}
|
2016-04-14 10:12:35 +09:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else if (!ready) {
|
|
|
|
return (
|
|
|
|
<div className="comments-list">
|
2016-05-22 16:42:24 +09:00
|
|
|
<Telescope.components.Loading/>
|
2016-04-14 10:12:35 +09:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<div className="comments-list">
|
|
|
|
<p>No comments to display.</p>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-05-22 16:42:24 +09:00
|
|
|
CommentsList.displayName = "CommentsList";
|
|
|
|
|
2016-04-14 10:12:35 +09:00
|
|
|
module.exports = CommentsList;
|