2016-02-15 22:33:44 +09:00
|
|
|
const PostList = props => {
|
|
|
|
|
2016-02-17 17:22:32 +09:00
|
|
|
({PostItem, LoadMore, PostsLoading, NoPosts, NoMorePosts, PostViews} = Telescope.components);
|
2016-02-15 22:33:44 +09:00
|
|
|
|
2016-02-16 15:40:37 +09:00
|
|
|
if (!!props.results.length) {
|
2016-02-15 22:33:44 +09:00
|
|
|
return (
|
|
|
|
<div className="postList">
|
2016-02-17 17:22:32 +09:00
|
|
|
<PostViews />
|
2016-02-19 18:38:39 +09:00
|
|
|
<div className="post-list-content">
|
|
|
|
{props.results.map(post => <PostItem post={post} currentUser={props.currentUser} key={post._id}/>)}
|
|
|
|
</div>
|
2016-02-15 22:33:44 +09:00
|
|
|
{props.hasMore ? (props.ready ? <LoadMore {...props}/> : <PostsLoading/>) : <NoMorePosts/>}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else if (!props.ready) {
|
|
|
|
return (
|
|
|
|
<div className="postList">
|
2016-03-02 13:55:07 +09:00
|
|
|
<PostViews />
|
|
|
|
<div className="post-list-content">
|
|
|
|
<PostsLoading/>
|
|
|
|
</div>
|
2016-02-15 22:33:44 +09:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<div className="postList">
|
2016-03-02 13:55:07 +09:00
|
|
|
<PostViews />
|
|
|
|
<div className="post-list-content">
|
|
|
|
<NoPosts/>
|
|
|
|
</div>
|
2016-02-15 22:33:44 +09:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = PostList;
|