通用评论

index.js 1011B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React, { Component } from "react";
  2. import { Spin } from "antd";
  3. import Comment from "../../Comment";
  4. import CommentBox from "../CommentBox";
  5. import "./index.css";
  6. class CommentList extends Component {
  7. constructor(props) {
  8. super(props);
  9. this.state = {};
  10. }
  11. render() {
  12. const {
  13. list,
  14. page,
  15. loading,
  16. isNoMoreComment,
  17. sGetComment
  18. } = this.props.app;
  19. const spinning = Boolean(loading.sGetComment || loading.sCommentFavor);
  20. return (
  21. <div>
  22. <Spin spinning={spinning}>
  23. {list.map(item => (
  24. <CommentBox content={item} key={item.id} commentId={item.id} />
  25. ))}
  26. {!isNoMoreComment && (
  27. <div
  28. className="showMore"
  29. onClick={() => sGetComment({ page: page + 1 })}
  30. >
  31. <span>查看更多评论</span>
  32. </div>
  33. )}
  34. </Spin>
  35. </div>
  36. );
  37. }
  38. }
  39. CommentList.propTypes = {};
  40. export default Comment(CommentList);