This repository has been archived on 2020-04-21. You can view files and clone it, but cannot push or open issues or pull requests.
lemmy/ui/src/components/post-listings.tsx

29 lines
773 B
TypeScript
Raw Normal View History

import { Component } from 'inferno';
import { Link } from 'inferno-router';
import { Post } from '../interfaces';
import { PostListing } from './post-listing';
interface PostListingsProps {
posts: Array<Post>;
showCommunity?: boolean;
}
export class PostListings extends Component<PostListingsProps, any> {
constructor(props: any, context: any) {
super(props, context);
}
render() {
return (
<div>
{this.props.posts.length > 0 ? this.props.posts.map(post =>
<PostListing post={post} showCommunity={this.props.showCommunity} />) :
<div>No posts. {this.props.showCommunity !== undefined && <span>Subscribe to some <Link to="/communities">communities</Link>.</span>}
</div>
}
</div>
)
}
}