Vulcan/packages/nova-base-components/lib/posts/PostsCommentsThread.jsx
Sacha Greif 6665a7c968 making component names and class names more consistent.
- Posts, Comments, Users, etc. are always pluralized.
- CSS classes are based off component names (PostsTitle -> posts-title)
2016-04-19 15:45:36 +09:00

42 lines
No EOL
1.3 KiB
JavaScript

import React from 'react';
import SmartContainers from "meteor/utilities:react-list-container";
const ListContainer = SmartContainers.ListContainer;
import Core from "meteor/nova:core";
const ModalTrigger = Core.ModalTrigger;
const PostsCommentsThread = ({document, currentUser}) => {
({CommentsList, CommentsNew, PostsItem, PostsCategories, SocialShare, Vote, PostsStats, HeadTags, AccountsForm} = Telescope.components);
const post = document;
return (
<div className="posts-comments-thread">
<h4 className="posts-comments-thread-title">Comments</h4>
<ListContainer
collection={Comments}
publication="comments.list"
selector={{postId: post._id}}
terms={{postId: post._id, view: "postComments"}}
limit={0}
parentProperty="parentCommentId"
joins={Comments.getJoins()}
component={CommentsList}
/>
{ currentUser ?
<div className="posts-comments-thread-new">
<h4>New Comment:</h4>
<CommentsNew type="comment" postId={post._id} />
</div> :
<div>
<ModalTrigger size="small" component={<a>Please log in to comment</a>}>
<AccountsForm/>
</ModalTrigger>
</div> }
</div>
)
};
module.exports = PostsCommentsThread;
export default PostsCommentsThread;