]> Untitled Git - lemmy.git/blob - ui/src/components/post-listings.tsx
Merge pull request #498 from iav/docs4arm
[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 { i18n } from '../i18next';
6
7 interface PostListingsProps {
8   posts: Array<Post>;
9   showCommunity?: boolean;
10 }
11
12 export class PostListings extends Component<PostListingsProps, any> {
13   constructor(props: any, context: any) {
14     super(props, context);
15   }
16
17   render() {
18     return (
19       <div>
20         {this.props.posts.length > 0 ? (
21           this.props.posts.map(post => (
22             <>
23               <PostListing
24                 post={post}
25                 showCommunity={this.props.showCommunity}
26               />
27               <hr class="d-md-none my-2" />
28               <div class="d-none d-md-block my-2"></div>
29             </>
30           ))
31         ) : (
32           <>
33             <div>{i18n.t('no_posts')}</div>
34             {this.props.showCommunity !== undefined && (
35               <div>
36                 <Link to="/communities">
37                   {i18n.t('subscribe_to_communities')}
38                 </Link>
39               </div>
40             )}
41           </>
42         )}
43       </div>
44     );
45   }
46 }