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
|
@ -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="Важный пост">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue