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

optimized scrolls

This commit is contained in:
Fedor Katurov 2019-10-23 10:42:25 +07:00
parent 948817e8fc
commit f169de370a
12 changed files with 110 additions and 98 deletions

View file

@ -1,4 +1,4 @@
import React, { FC, HTMLAttributes } from 'react';
import React, { FC, HTMLAttributes, memo } from 'react';
import { CommentWrapper } from '~/components/containers/CommentWrapper';
import { ICommentGroup } from '~/redux/types';
import { getURL } from '~/utils/dom';
@ -12,30 +12,25 @@ type IProps = HTMLAttributes<HTMLDivElement> & {
is_same?: boolean;
};
const Comment: FC<IProps> = ({
comment_group,
is_empty,
is_same,
is_loading,
className,
...props
}) => {
return (
<CommentWrapper
className={className}
is_empty={is_empty}
is_loading={is_loading}
user={comment_group.user}
is_same={is_same}
{...props}
>
<div className={styles.wrap}>
{comment_group.comments.map(comment => (
<CommentContent comment={comment} key={comment.id} />
))}
</div>
</CommentWrapper>
);
};
const Comment: FC<IProps> = memo(
({ comment_group, is_empty, is_same, is_loading, className, ...props }) => {
return (
<CommentWrapper
className={className}
is_empty={is_empty}
is_loading={is_loading}
user={comment_group.user}
is_same={is_same}
{...props}
>
<div className={styles.wrap}>
{comment_group.comments.map(comment => (
<CommentContent comment={comment} key={comment.id} />
))}
</div>
</CommentWrapper>
);
}
);
export { Comment };