1
0
Fork 0
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:
Fedor Katurov 2021-03-31 14:43:01 +07:00
parent 1db5c64d06
commit d865067eaf
6 changed files with 26 additions and 18 deletions

View file

@ -1,24 +1,23 @@
import React, { FC } from 'react';
import { INode } from '~/redux/types';
import styles from './styles.module.scss';
import { URLS } from '~/constants/urls';
import { Link } from 'react-router-dom';
import { Group } from '~/components/containers/Group';
import { Icon } from '~/components/input/Icon';
import Tippy from '@tippy.js/react';
import { useGotoNode } from '~/utils/hooks/node/useGotoNode';
interface IProps {
node: INode;
}
const LabNodeTitle: FC<IProps> = ({ node }) => {
const onClick = useGotoNode(node.id);
if (!node.title) return null;
return (
<Group horizontal className={styles.wrap}>
<div className={styles.title}>
<Link to={URLS.NODE_URL(node.id)}>{node.title || '...'}</Link>
</div>
<Group horizontal className={styles.wrap} onClick={onClick}>
<div className={styles.title}>{node.title || '...'}</div>
{node.is_heroic && (
<Tippy content="Важный пост">