No Description

CommentList.tsx 853B

123456789101112131415161718192021222324252627282930313233
  1. import React, { PureComponent } from 'react'
  2. import CommentItem, { CommentItemData } from './CommentItem';
  3. import { Divider } from 'antd';
  4. import styles from './CommentList.less';
  5. interface IP {
  6. list: Array<CommentItemData>;
  7. topDivider: boolean;
  8. onChangeListItem({ commentId, changeProp }: { commentId: string; changeProp: any; }): any;
  9. }
  10. interface IS {
  11. }
  12. export default class CommentList extends PureComponent<IP, IS> {
  13. render() {
  14. return (
  15. <div className={styles.wrapper}>
  16. {this.props.topDivider ? <Divider /> : null}
  17. {this.props.list.map((i, index) => {
  18. return (
  19. <>
  20. <CommentItem data={i} onChangeListItem={this.props.onChangeListItem} />
  21. {index === this.props.list.length - 1 ? null : <Divider />}
  22. </>
  23. )
  24. })}
  25. </div>
  26. )
  27. }
  28. }