Files
astuto/app/javascript/components/Board/PostListItem.tsx
2019-09-12 18:03:19 +02:00

37 lines
1006 B
TypeScript

import * as React from 'react';
import PostStatusLabel from '../shared/PostStatusLabel';
import IPostStatus from '../../interfaces/IPostStatus';
interface Props {
id: number;
title: string;
description?: string;
postStatus: IPostStatus;
}
const PostListItem = ({ id, title, description, postStatus}: Props) => (
<a href={`/posts/${id}`} className="postLink">
<div className="postListItem">
<div className="postTitle">{title}</div>
<div className="postDescription">
{
description && description.length > 120 ?
description.slice(0, 119) + '...'
:
description || '<No description provided.>'
}
</div>
<div className="postDetails">
<div className="postDetailsComments">
<span className="comment icon"></span>
<span>0 comments</span>
</div>
{ postStatus ? <PostStatusLabel {...postStatus} /> : null }
</div>
</div>
</a>
);
export default PostListItem;