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:
parent
6bf14e6d5c
commit
39b0a2d568
6 changed files with 35 additions and 16 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue