mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
29 lines
816 B
TypeScript
29 lines
816 B
TypeScript
import React, { FC } from 'react';
|
|
import { INodeComponentProps } from '~/redux/node/constants';
|
|
import styles from './styles.module.scss';
|
|
import { Markdown } from '~/components/containers/Markdown';
|
|
import { formatText } from '~/utils/dom';
|
|
import { useGotoNode } from '~/utils/hooks/node/useGotoNode';
|
|
import { Paragraph } from '~/components/placeholders/Paragraph';
|
|
|
|
const LabDescription: FC<INodeComponentProps> = ({ node, isLoading }) => {
|
|
const onClick = useGotoNode(node.id);
|
|
|
|
if (!node.description) {
|
|
return null;
|
|
}
|
|
|
|
return isLoading ? (
|
|
<div className={styles.wrap}>
|
|
<Paragraph />
|
|
</div>
|
|
) : (
|
|
<Markdown
|
|
className={styles.wrap}
|
|
dangerouslySetInnerHTML={{ __html: formatText(node.description) }}
|
|
onClick={onClick}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export { LabDescription };
|