Vulcan/packages/nova-components/lib/posts/Post.jsx

34 lines
872 B
React
Raw Normal View History

const Post = (props) => {
2016-02-18 16:26:52 +09:00
2016-02-18 17:53:04 +09:00
({ListContainer, CommentList, CommentNew} = Telescope.components);
2016-02-18 16:26:52 +09:00
const htmlBody = {__html: props.htmlBody};
return (
<div className="post">
2016-02-18 16:26:52 +09:00
<h3>{props.title}</h3>
2016-02-16 16:12:13 +09:00
<p>{props.commentCount} comments</p>
<p>{moment(props.postedAt).fromNow()}</p>
2016-02-18 16:26:52 +09:00
<div dangerouslySetInnerHTML={htmlBody}></div>
2016-02-16 16:12:13 +09:00
<div className="comments-thread">
<h4>Comments</h4>
2016-02-18 16:26:52 +09:00
<ListContainer
collection={Comments}
publication="comments.list"
selector={{postId: props._id}}
terms={{postId: props._id, view: "postComments"}}
component={CommentList}
limit={0}
2016-02-18 17:53:04 +09:00
parentProperty="parentCommentId"
2016-02-18 16:26:52 +09:00
/>
2016-02-18 17:53:04 +09:00
<h4>New Comment:</h4>
<CommentNew type="comment" postId={props._id}/>
2016-02-16 16:12:13 +09:00
</div>
2016-02-18 16:26:52 +09:00
</div>
)
}
module.exports = Post;