-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec7f5ab
commit b181e54
Showing
1 changed file
with
24 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
import React from 'react'; | ||
import { PostData } from '../../types/PostData'; | ||
import { Post } from '../../types/api.types'; | ||
import { UserInfo } from '../UserInfo/UserInfo'; | ||
import { CommentList } from '../CommentList'; | ||
import { UserInfo } from '../UserInfo'; | ||
import './PostInfo.scss'; | ||
|
||
type PostProp = { | ||
post: PostData, | ||
type PostInfoProps = { | ||
post: Post, | ||
}; | ||
|
||
export const PostInfo: React.FC<PostProp> = ({ post }) => ( | ||
<div className="PostInfo"> | ||
<div className="PostInfo__header"> | ||
<h3 className="PostInfo__title">{post.title}</h3> | ||
export const PostInfo: React.FC<PostInfoProps> = ({ post }) => { | ||
return ( | ||
<div className="PostInfo"> | ||
<div className="PostInfo__header"> | ||
<h3 className="PostInfo__title">{post.title}</h3> | ||
|
||
<p> | ||
{' Posted by '} | ||
<p> | ||
{' Posted by '} | ||
|
||
{post.user && <UserInfo user={post.user} />} | ||
{post.user !== null && <UserInfo user={post.user} />} | ||
</p> | ||
</div> | ||
|
||
<p className="PostInfo__body"> | ||
{post.body} | ||
</p> | ||
</div> | ||
|
||
<p className="PostInfo__body"> | ||
{post.body} | ||
</p> | ||
<hr /> | ||
|
||
<hr /> | ||
{post.comments.length | ||
? <CommentList key={post.id} comments={post.comments} /> | ||
: <b data-cy="NoCommentsMessage">No comments yet</b>} | ||
|
||
{post.comments.length > 0 | ||
? <CommentList comments={post.comments} /> | ||
: <b data-cy="NoCommentsMessage">No comments yet</b>} | ||
</div> | ||
); | ||
</div> | ||
); | ||
}; |