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
|
@ -6,15 +6,14 @@ import { path } from 'ramda';
|
|||
import styles from './styles.module.scss';
|
||||
import { useHistory } from 'react-router';
|
||||
import { URLS } from '~/constants/urls';
|
||||
import { useGotoNode } from '~/utils/hooks/node/useGotoNode';
|
||||
|
||||
const LabText: FC<INodeComponentProps> = ({ node }) => {
|
||||
const content = useMemo(() => formatTextParagraphs(path(['blocks', 0, 'text'], node) || ''), [
|
||||
node.blocks,
|
||||
]);
|
||||
|
||||
const history = useHistory();
|
||||
|
||||
const onClick = useCallback(() => history.push(URLS.NODE_URL(node.id)), [node.id]);
|
||||
const onClick = useGotoNode(node.id);
|
||||
|
||||
return (
|
||||
<Markdown
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue