Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import React from 'react';
  2.  
  3. export default function CommentList({loading, comments, totalCount}) {
  4. if (loading) {
  5. return <div>empty</div>;
  6. }
  7.  
  8. if (comments.length === 0) {
  9. return <div>loading</div>;
  10. }
  11.  
  12. return (
  13. <CommentListDiv>
  14. {comments.map(({text, author: {name, avatar}}) => (
  15. <CommentItemDiv>
  16. <AvatarDiv><AvatarImg src={avatar} /></AvatarDiv>
  17. <MessageDiv>
  18. <AuthorSpan><LinkTo href=`/character/${item.id}`>{name}</LinkTo></AuthorSpan>
  19. <TextSpan>{text}</TextSpan>
  20. </MessageDiv>
  21. </CommentItemDiv>
  22. ))}
  23. </CommentListDiv>
  24. );
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement