import React, { PropTypes, Component } from 'react'; import { Button } from 'react-bootstrap'; class PostItem extends Component { renderCategories() { ({PostCategories} = Telescope.components); return this.props.post.categoriesArray ? : ""; } renderCommenters() { ({PostCommenters} = Telescope.components); return this.props.post.commentersArray ? : ""; } renderActions() { ({ModalTrigger, DocumentContainer, EditDocContainer} = Telescope.components); const component = ( Edit}> ); return (
{Users.can.edit(this.props.currentUser, this.props.post) ? component : ""}
) } render() { ({UserAvatar, UserName, Vote, PostStats} = Telescope.components); const post = this.props.post; // console.log(post) // console.log(post.user) return (

{post.title} {this.renderCategories()}

{moment(post.postedAt).fromNow()}
{this.renderActions()}
{this.renderCommenters()}
) } }; PostItem.propTypes = { post: React.PropTypes.object.isRequired, // the current comment currentUser: React.PropTypes.object, // the current user } module.exports = PostItem;