-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathPostCommentItem.js
More file actions
34 lines (30 loc) · 903 Bytes
/
PostCommentItem.js
File metadata and controls
34 lines (30 loc) · 903 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, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import styles from './PostCommentItem.css';
export class PostCommentItem extends PureComponent {
render() {
const { name, content, deleteComment, editComment, cuid } = this.props;
return (
<div className={styles.root}>
<div className={styles.header}>
<p className={styles.name}>{name}</p>
<div className={styles.headerActions}>
<p onClick={() => editComment(cuid)}>edit</p>
<p onClick={() => deleteComment(cuid)}>delete</p>
</div>
</div>
<p className={styles.content}>{content}</p>
</div>
);
}
}
PostCommentItem.propTypes = {
name: PropTypes.string,
content: PropTypes.string,
deleteComment: PropTypes.func,
editComment: PropTypes.func,
};
PostCommentItem.defaultProps = {
name: '',
content: '',
};