mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
#35 refactored node layout
This commit is contained in:
parent
428c7e7a06
commit
d3473eab4c
20 changed files with 406 additions and 344 deletions
28
src/components/node/NodeCommentsBlock/index.tsx
Normal file
28
src/components/node/NodeCommentsBlock/index.tsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import React, { FC } from 'react';
|
||||
import { NodeNoComments } from '~/components/node/NodeNoComments';
|
||||
import { NodeComments } from '~/components/node/NodeComments';
|
||||
import { IComment, INode } from '~/redux/types';
|
||||
import { useNodeBlocks } from '~/utils/hooks/node/useNodeBlocks';
|
||||
import { useUser } from '~/utils/hooks/user/userUser';
|
||||
|
||||
interface IProps {
|
||||
order: 'ASC' | 'DESC';
|
||||
node: INode;
|
||||
comments: IComment[];
|
||||
count: number;
|
||||
isLoading: boolean;
|
||||
isLoadingComments: boolean;
|
||||
}
|
||||
|
||||
const NodeCommentsBlock: FC<IProps> = ({ isLoading, isLoadingComments, node, comments, count }) => {
|
||||
const user = useUser();
|
||||
const { inline } = useNodeBlocks(node, isLoading);
|
||||
|
||||
return isLoading || isLoadingComments || (!comments.length && !inline) ? (
|
||||
<NodeNoComments is_loading={isLoadingComments || isLoading} />
|
||||
) : (
|
||||
<NodeComments count={count} comments={comments} user={user} order="DESC" />
|
||||
);
|
||||
};
|
||||
|
||||
export { NodeCommentsBlock };
|
Loading…
Add table
Add a link
Reference in a new issue