Files
astuto/app/javascript/components/Roadmap/PostList.tsx

35 lines
914 B
TypeScript
Raw Normal View History

2019-08-26 14:29:56 +02:00
import * as React from 'react';
import I18n from 'i18n-js';
2019-08-26 14:29:56 +02:00
import PostListItem from './PostListItem';
import { CenteredMutedText } from '../common/CustomTexts';
2019-08-26 14:29:56 +02:00
import IPostJSON from '../../interfaces/json/IPost';
2019-08-26 14:29:56 +02:00
import IBoard from '../../interfaces/IBoard';
interface Props {
posts: Array<IPostJSON>;
2019-08-26 14:29:56 +02:00
boards: Array<IBoard>;
openPostsInNewTab: boolean;
2019-08-26 14:29:56 +02:00
}
const PostList = ({ posts, boards, openPostsInNewTab }: Props) => (
2019-08-26 14:29:56 +02:00
<div className="postList">
2019-09-06 14:36:26 +02:00
{
posts.length > 0 ?
posts.map((post, i) => (
<PostListItem
2019-09-12 15:51:45 +02:00
id={post.id}
2019-09-06 14:36:26 +02:00
title={post.title}
boardName={boards.find(board => board.id === post.board_id).name}
openPostInNewTab={openPostsInNewTab}
2019-09-06 14:36:26 +02:00
key={i}
/>
))
:
<CenteredMutedText>{ I18n.t('board.posts_list.empty') }</CenteredMutedText>
2019-09-06 14:36:26 +02:00
}
2019-08-26 14:29:56 +02:00
</div>
);
export default PostList;