import * as React from 'react'; import I18n from 'i18n-js'; import InfiniteScroll from 'react-infinite-scroller'; import PostListItem from './PostListItem'; import Spinner from '../shared/Spinner'; import { DangerText, CenteredMutedText, } from '../shared/CustomTexts'; import IPost from '../../interfaces/IPost'; import IPostStatus from '../../interfaces/IPostStatus'; interface Props { posts: Array; postStatuses: Array; areLoading: boolean; error: string; hasMore: boolean; handleLoadMore(): void; isLoggedIn: boolean; authenticityToken: string; } const PostList = ({ posts, postStatuses, areLoading, error, hasMore, handleLoadMore, isLoggedIn, authenticityToken, }: Props) => (
{ error ? {error} : null } } useWindow={true} > { posts.length > 0 ? posts.map((post, i) => ( postStatus.id === post.postStatusId)} likesCount={post.likesCount} liked={post.liked} commentsCount={post.commentsCount} isLoggedIn={isLoggedIn} authenticityToken={authenticityToken} key={i} /> )) : areLoading ?

: {I18n.t('board.posts_list.empty')} }
); export default PostList;