mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 12:16:37 -04:00
52 lines
No EOL
1.3 KiB
JavaScript
52 lines
No EOL
1.3 KiB
JavaScript
import React, { PropTypes, Component } from 'react';
|
|
import { ListContainer } from "meteor/utilities:react-list-container";
|
|
import moment from 'moment';
|
|
|
|
class PostsDay extends Component {
|
|
|
|
render() {
|
|
|
|
const {date, number} = this.props;
|
|
|
|
const terms = {
|
|
view: "top",
|
|
date: date,
|
|
after: moment(date).format("YYYY-MM-DD"),
|
|
before: moment(date).format("YYYY-MM-DD"),
|
|
enableCache: number <= 15 ? true : false, // only cache first 15 days
|
|
listId: `posts.list.${moment(date).format("YYYY-MM-DD")}`
|
|
};
|
|
|
|
({selector, options} = Posts.parameters.get(terms));
|
|
|
|
const postsPerPage = Telescope.settings.get("postsPerPage", 10);
|
|
|
|
return (
|
|
<div className="posts-day">
|
|
<h4 className="posts-day-heading">{moment(date).format("dddd, MMMM Do YYYY")}</h4>
|
|
<ListContainer
|
|
collection={Posts}
|
|
publication="posts.list"
|
|
selector={selector}
|
|
options={options}
|
|
terms={terms}
|
|
joins={Posts.getJoins()}
|
|
component={Telescope.components.PostsList}
|
|
componentProps={{showHeader: false}}
|
|
listId={terms.listId}
|
|
limit={postsPerPage}
|
|
/>
|
|
</div>
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PostsDay.propTypes = {
|
|
date: React.PropTypes.object,
|
|
number: React.PropTypes.number
|
|
}
|
|
|
|
module.exports = PostsDay;
|
|
export default PostsDay; |