mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed lab node click handlers with hooks
This commit is contained in:
parent
1db5c64d06
commit
d865067eaf
6 changed files with 26 additions and 18 deletions
|
@ -3,8 +3,11 @@ 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';
|
||||
|
||||
const LabDescription: FC<INodeComponentProps> = ({ node }) => {
|
||||
const onClick = useGotoNode(node.id);
|
||||
|
||||
if (!node.description) {
|
||||
return null;
|
||||
}
|
||||
|
@ -13,6 +16,7 @@ const LabDescription: FC<INodeComponentProps> = ({ node }) => {
|
|||
<Markdown
|
||||
className={styles.wrap}
|
||||
dangerouslySetInnerHTML={{ __html: formatText(node.description) }}
|
||||
onClick={onClick}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue