-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathPostComments.jsx
More file actions
37 lines (34 loc) · 1.01 KB
/
PostComments.jsx
File metadata and controls
37 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from "react";
import AddCommentForm from "../AddCommentForm/AddCommentForm";
import Comment from "../Comment/Comment.jsx";
import styles from "./PostComments.css";
import PropTypes from "prop-types";
const PostComments = (props) => {
return (
<React.Fragment>
<AddCommentForm onAddComment={props.onAddComment} />
{props.comments.map((comment) => (
<Comment
onDeleteComment={props.onDeleteComment}
onEditComment={props.onEditComment}
key={comment.createDate}
{...comment}
/>
))}
<div
onClick={props.handleToggleComments}
className={styles["collapse-comments"]}
>
Collapse comments
</div>
</React.Fragment>
);
};
PostComments.propTypes = {
handleToggleComments: PropTypes.func.isRequired,
onAddComment: PropTypes.func.isRequired,
onDeleteComment: PropTypes.func.isRequired,
onEditComment: PropTypes.func.isRequired,
comments: PropTypes.array.isRequired,
};
export default PostComments;