1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

floating node panel

This commit is contained in:
Fedor Katurov 2019-10-13 21:11:20 +07:00
parent 9e25b4e2b0
commit 336582b3d6
7 changed files with 200 additions and 113 deletions

View file

@ -1,4 +1,4 @@
import React, { FC, createElement, useEffect, useCallback } from 'react';
import React, { FC, createElement, useEffect, useCallback, useState } from 'react';
import { RouteComponentProps } from 'react-router';
import { connect } from 'react-redux';
@ -41,6 +41,10 @@ const NodeLayoutUnconnected: FC<IProps> = ({
nodeLoadNode,
nodeUpdateTags,
}) => {
const [layout, setLayout] = useState({});
const updateLayout = useCallback(() => setLayout({}), []);
useEffect(() => {
if (is_loading) return;
nodeLoadNode(parseInt(id, 10), null);
@ -56,9 +60,9 @@ const NodeLayoutUnconnected: FC<IProps> = ({
return (
<Card className={styles.node} seamless>
{block && createElement(block, { node, is_loading })}
{block && createElement(block, { node, is_loading, updateLayout, layout })}
<NodePanel node={node} />
<NodePanel node={node} layout={layout} />
<Group>
<Padder>