diff options
Diffstat (limited to 'src/components/CommentsList/CommentsList.tsx')
| -rw-r--r-- | src/components/CommentsList/CommentsList.tsx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/components/CommentsList/CommentsList.tsx b/src/components/CommentsList/CommentsList.tsx new file mode 100644 index 0000000..6599475 --- /dev/null +++ b/src/components/CommentsList/CommentsList.tsx @@ -0,0 +1,24 @@ +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 ( + <> + {comments.length > 0 ? ( + <ol className={styles.list}>{getCommentsList()}</ol> + ) : ( + <p>{t`No comments yet.`}</p> + )} + </> + ); +}; + +export default CommentsList; |
