]> Untitled Git - lemmy.git/blob - ui/src/components/post-listings.tsx
Adding some UI suggestions.
[lemmy.git] / ui / src / components / post-listings.tsx
1 import { Component } from 'inferno';
2 import { Link } from 'inferno-router';
3 import { Post } from '../interfaces';
4 import { PostListing } from './post-listing';
5 import { T } from 'inferno-i18next';
6
7 interface PostListingsProps {
8   posts: Array<Post>;
9   showCommunity?: boolean;
10 }
11
12 export class PostListings extends Component<PostListingsProps, any> {
13
14   constructor(props: any, context: any) {
15     super(props, context);
16   }
17
18   render() {
19     return (
20       <div>
21         {this.props.posts.length > 0 ? this.props.posts.map(post => 
22           <>
23             <PostListing post={post} showCommunity={this.props.showCommunity} />
24             <hr class="my-2" />
25           </>
26             ) : 
27           <>
28             <div><T i18nKey="no_posts">#</T></div>
29             {this.props.showCommunity !== undefined  && <div><T i18nKey="subscribe_to_communities">#<Link to="/communities">#</Link></T></div>}
30           </>
31         }
32       </div>
33     )
34   }
35 }