1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

group comments (bad way)

This commit is contained in:
Fedor Katurov 2019-10-12 15:17:07 +07:00
parent 6bf14e6d5c
commit 39b0a2d568
6 changed files with 35 additions and 16 deletions

View file

@ -1,24 +1,24 @@
import React, { FC } from 'react';
import range from 'ramda/es/range';
import { Comment } from '../Comment';
import { INode } from '~/redux/types';
import { CommentForm } from '../CommentForm';
import { Group } from '~/components/containers/Group';
import * as styles from './styles.scss';
import { Filler } from '~/components/containers/Filler';
import * as styles from './styles.scss';
interface IProps {
comments?: any;
}
const isSameComment = (comments, index) =>
comments[index - 1] && comments[index - 1].user.id === comments[index].user.id;
const NodeComments: FC<IProps> = ({ comments }) => (
<Group className={styles.wrap}>
{comments.map(comment => (
<Comment key={comment.id} comment={comment} />
<div className={styles.wrap}>
{comments.map((comment, index) => (
<Comment key={comment.id} comment={comment} is_same={isSameComment(comments, index)} />
))}
<Filler />
</Group>
</div>
);
export { NodeComments };