Vulcan/packages/nova-base-components/lib/posts/PostsDay.jsx

37 lines
934 B
React
Raw Normal View History

import { Components, registerComponent } from 'meteor/nova:lib';
2016-03-22 10:22:46 +09:00
import React, { PropTypes, Component } from 'react';
2016-03-30 10:52:40 +09:00
class PostsDay extends Component {
render() {
2017-01-09 22:09:09 +09:00
const {date, posts, networkStatus} = this.props;
const noPosts = posts.length === 0;
const loading = noPosts && networkStatus === 2;
2016-06-07 09:43:23 +09:00
return (
<div className="posts-day">
2016-12-05 16:30:31 +09:00
<h4 className="posts-day-heading">{date.format("dddd, MMMM Do YYYY")}</h4>
2017-01-09 22:09:09 +09:00
{loading ? <Components.PostsLoading/> :
noPosts ? <Components.PostsNoMore /> :
<div className="posts-list">
<div className="posts-list-content">
{posts.map(post => <Components.PostsItem post={post} key={post._id} />)}
</div>
</div>
}
</div>
)
}
2016-03-22 10:22:46 +09:00
}
2016-04-14 10:12:35 +09:00
PostsDay.propTypes = {
2016-03-22 10:22:46 +09:00
date: React.PropTypes.object,
number: React.PropTypes.number
}
registerComponent('PostsDay', PostsDay);