Vulcan/packages/example-permissions/lib/components/comments/CommentsList.jsx

36 lines
910 B
React
Raw Normal View History

/*
List of comments.
Wrapped with the "withList" and "withCurrentUser" containers.
All props except currentUser are passed by the withList container.
*/
import React from 'react';
2017-10-06 08:49:36 +09:00
import { registerComponent, Components, withList, withCurrentUser, Loading } from 'meteor/vulcan:core';
import Comments from '../../modules/comments/collection.js';
const CommentsList = ({results = [], currentUser, loading, loadMore, count, totalCount, pic}) =>
<div className="comments-list">
{loading ?
<Loading /> :
<div className="comments-items">
2017-10-06 08:49:36 +09:00
{results.map(comment => <Components.CommentsItem key={comment._id} comment={comment} currentUser={currentUser} pic={pic} />)}
</div>
}
</div>
const options = {
collection: Comments,
fragmentName: 'CommentsItemFragment',
};
2017-10-06 08:49:36 +09:00
registerComponent('CommentsList', CommentsList, withCurrentUser, [withList, options]);