const PostItem = React.createClass({ propTypes: { post: React.PropTypes.object.isRequired, // the current comment currentUser: React.PropTypes.object, // the current user }, renderCategories() { ({PostCategories} = Telescope.components); return this.props.post.categoriesArray ? : ""; }, renderCommenters() { ({PostCommenters} = Telescope.components); return this.props.post.commentersArray ? : ""; }, renderActions() { ({ModalButton, DocumentContainer, EditDocContainer} = Telescope.components); const component = ( ); return ( {Users.can.edit(this.props.currentUser, this.props.post) ? component : ""} ) }, render() { const post = this.props.post; return ( {post.title} {Users.getDisplayName(post.user)}, {moment(post.postedAt).fromNow()}, {post.commentCount} comments {this.renderCategories()} {this.renderCommenters()} {this.renderActions()} ) } }); module.exports = PostItem;
{Users.getDisplayName(post.user)}, {moment(post.postedAt).fromNow()}, {post.commentCount} comments