Vulcan/packages/nova-components/lib/posts/Post.jsx
2016-02-23 11:34:40 +09:00

36 lines
No EOL
1,001 B
JavaScript

const Post = (props) => {
({ListContainer, CommentList, CommentNew, PostCategories} = Telescope.components);
const post = props.document;
const htmlBody = {__html: post.htmlBody};
return (
<div className="post">
<h3>{post.title}</h3>
<p>{post.commentCount} comments</p>
<p>{moment(post.postedAt).fromNow()}</p>
{post.categoriesArray ? <PostCategories categories={post.categoriesArray} /> : ""}
<div dangerouslySetInnerHTML={htmlBody}></div>
<div className="comments-thread">
<h4>Comments</h4>
<ListContainer
collection={Comments}
publication="comments.list"
selector={{postId: post._id}}
terms={{postId: post._id, view: "postComments"}}
component={CommentList}
limit={0}
parentProperty="parentCommentId"
/>
<h4>New Comment:</h4>
<CommentNew type="comment" postId={post._id}/>
</div>
</div>
)
}
module.exports = Post;