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

32 lines
741 B
TypeScript
Raw Normal View History

2019-08-26 14:29:56 +02:00
import * as React from 'react';
import PostListItem from './PostListItem';
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>;
}
const PostList = ({ posts, boards }: Props) => (
<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}
2019-08-26 14:29:56 +02:00
2019-09-06 14:36:26 +02:00
key={i}
/>
))
:
<span className="infoText text-muted">There are no posts that have this status.</span>
}
2019-08-26 14:29:56 +02:00
</div>
);
export default PostList;