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

33 lines
924 B
React
Raw Normal View History

2017-05-19 14:42:43 -06:00
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
2017-03-23 16:27:59 +09:00
import { Components, registerComponent } from 'meteor/vulcan:core';
2016-03-30 10:52:40 +09:00
2017-05-19 14:42:43 -06:00
class PostsDay extends PureComponent {
render() {
const {date, posts} = this.props;
2017-01-09 22:09:09 +09:00
const noPosts = posts.length === 0;
2016-06-07 09:43:23 +09:00
return (
<div className="posts-day">
2017-05-19 14:42:43 -06:00
<h4 className="posts-day-heading">{date.format('dddd, MMMM Do YYYY')}</h4>
2017-01-16 10:27:42 +09:00
{ noPosts ? <Components.PostsNoMore /> :
<div className="posts-list">
<div className="posts-list-content">
2017-05-16 11:04:43 +09:00
{posts.map((post, index) => <Components.PostsItem post={post} key={post._id} index={index} currentUser={this.props.currentUser} />)}
2017-01-09 22:09:09 +09:00
</div>
2017-01-16 10:27:42 +09:00
</div>
2017-01-09 22:09:09 +09:00
}
</div>
2017-05-19 14:42:43 -06:00
);
}
2016-03-22 10:22:46 +09:00
}
2016-04-14 10:12:35 +09:00
PostsDay.propTypes = {
2017-05-19 14:42:43 -06:00
currentUser: PropTypes.object,
date: PropTypes.object,
number: PropTypes.number
};
2016-03-22 10:22:46 +09:00
registerComponent('PostsDay', PostsDay);