-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathCommentList.js
More file actions
34 lines (29 loc) · 812 Bytes
/
CommentList.js
File metadata and controls
34 lines (29 loc) · 812 Bytes
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
import React from 'react';
import PropTypes from 'prop-types';
import CommentItem from './CommentItem/CommentItem';
import styles from './CommentList.css';
function CommentList(props) {
return (
<div
className={`${styles['comment-container']}`}
>
{props.data ? props.data.map(comment => (
<CommentItem
key={comment.cuid}
data={comment}
handleDelete={props.handleDelete}
/>
)) : <p>Download...</p>}
</div>
);
}
CommentList.propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({
name: PropTypes.string.isRequired,
date: PropTypes.string.isRequired,
cuid: PropTypes.string.isRequired,
post: PropTypes.string.isRequired,
})),
handleDelete: PropTypes.func.isRequired,
};
export default CommentList;