aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/CommentsList/CommentsList.tsx
blob: 3a1c57efacbe61c311ef46ac371aa6a296b592a2 (plain)
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
import { Comment as CommentData } from '@ts/types/comments';
import Comment from '@components/Comment/Comment';
import { t } from '@lingui/macro';
import styles from './CommentsList.module.scss';

const CommentsList = ({ comments }: { comments: CommentData[] }) => {
  const getCommentsList = () => {
    return comments.map((comment) => {
      return <Comment key={comment.id} comment={comment} />;
    });
  };

  return (
    <>
      <h2 className={styles.title}>{t`Comments`}</h2>
      {comments.length > 0 ? (
        <ol className={styles.list}>{getCommentsList()}</ol>
      ) : (
        <p className={styles['no-comments']}>{t`No comments yet.`}</p>
      )}
    </>
  );
};

export default CommentsList;