-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathCommentList.js
More file actions
38 lines (33 loc) · 960 Bytes
/
CommentList.js
File metadata and controls
38 lines (33 loc) · 960 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
35
36
37
38
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
// Import style
import styles from './CommentList.css';
// Import Components
import CommentListItem from '../components/CommentListItem/CommentListItem';
function CommentList({ comments, deleteComment }) {
return (
<div className={styles.container}>
{comments && comments.length ? comments.map(comment => (
<CommentListItem
key={comment.cuid}
comment={comment}
onDelete={deleteComment}
/>
)) : (
<div className={styles['no-comments']}>
<FormattedMessage id="emptyComments" />
</div>
)}
</div>
);
}
CommentList.propTypes = {
comments: PropTypes.arrayOf(PropTypes.shape({
cuid: PropTypes.string,
author: PropTypes.string,
content: PropTypes.string,
})),
deleteComment: PropTypes.func.isRequired,
};
export default CommentList;