mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00

- Posts, Comments, Users, etc. are always pluralized. - CSS classes are based off component names (PostsTitle -> posts-title)
30 lines
No EOL
839 B
JavaScript
30 lines
No EOL
839 B
JavaScript
import React from 'react';
|
|
|
|
const CommentsList = ({results, currentUser, hasMore, ready, count, totalCount, loadMore}) => {
|
|
|
|
({CommentsLoadMore, Loading, PostsNoResults, PostsNoMore, CommentsNode} = Telescope.components);
|
|
|
|
if (!!results.length) {
|
|
return (
|
|
<div className="comments-list">
|
|
{results.map(comment => <CommentsNode comment={comment} key={comment._id} currentUser={currentUser}/>)}
|
|
{hasMore ? (ready ? <CommentsLoadMore loadMore={loadMore} count={count} totalCount={totalCount} /> : <Loading/>) : null}
|
|
</div>
|
|
)
|
|
} else if (!ready) {
|
|
return (
|
|
<div className="comments-list">
|
|
<Loading/>
|
|
</div>
|
|
)
|
|
} else {
|
|
return (
|
|
<div className="comments-list">
|
|
<p>No comments to display.</p>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
};
|
|
|
|
module.exports = CommentsList; |