import { CommentItem } from './CommentItem';
import { GroupCommentListProps, StandardCommentListProps } from './types';

type CommentListProps = GroupCommentListProps | StandardCommentListProps;

export const CommentList = (allProps: CommentListProps) => {
  const { comments, ...itemProps } = allProps;

  return comments.map(comment => (
    <CommentItem
      key={comment.id}
      comment={comment}
      {...itemProps}
    />
  ));
};
