2019-04-29 00:19:04 +00:00
|
|
|
import { Component } from 'inferno';
|
2019-04-05 19:14:54 +00:00
|
|
|
import { Link } from 'inferno-router';
|
2019-04-29 00:19:04 +00:00
|
|
|
import { Post } from '../interfaces';
|
2019-04-05 19:14:54 +00:00
|
|
|
import { PostListing } from './post-listing';
|
|
|
|
|
|
|
|
interface PostListingsProps {
|
|
|
|
posts: Array<Post>;
|
2019-04-29 00:19:04 +00:00
|
|
|
showCommunity?: boolean;
|
2019-04-05 19:14:54 +00:00
|
|
|
}
|
|
|
|
|
2019-04-29 00:19:04 +00:00
|
|
|
export class PostListings extends Component<PostListingsProps, any> {
|
2019-04-05 19:14:54 +00:00
|
|
|
|
2019-04-08 05:19:02 +00:00
|
|
|
constructor(props: any, context: any) {
|
2019-04-05 19:14:54 +00:00
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
2019-04-29 00:19:04 +00:00
|
|
|
{this.props.posts.length > 0 ? this.props.posts.map(post =>
|
|
|
|
<PostListing post={post} showCommunity={this.props.showCommunity} />) :
|
2019-04-29 02:05:11 +00:00
|
|
|
<div>No posts. {this.props.showCommunity !== undefined && <span>Subscribe to some <Link to="/communities">communities</Link>.</span>}
|
2019-04-08 21:46:09 +00:00
|
|
|
</div>
|
2019-04-05 19:14:54 +00:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|