Skip to content

Commit

Permalink
Update PostInfo.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
netzelnatalia authored Nov 19, 2023
1 parent ec7f5ab commit b181e54
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions src/components/PostInfo/PostInfo.tsx
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>
);
};

0 comments on commit b181e54

Please sign in to comment.