1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 13:26:40 +07:00

node edit and like buttons + actions

This commit is contained in:
Fedor Katurov 2019-10-22 12:17:45 +07:00
parent f4c337b255
commit 249a9b368c
7 changed files with 117 additions and 28 deletions

View file

@ -7,9 +7,14 @@ import { NodePanelInner } from '~/components/node/NodePanelInner';
interface IProps {
node: INode;
layout: {};
can_edit: boolean;
can_like: boolean;
onEdit: () => void;
onLike: () => void;
}
const NodePanel: FC<IProps> = ({ node, layout }) => {
const NodePanel: FC<IProps> = ({ node, layout, can_edit, can_like, onEdit, onLike }) => {
const [stack, setStack] = useState(false);
const ref = useRef(null);
@ -37,9 +42,25 @@ const NodePanel: FC<IProps> = ({ node, layout }) => {
return (
<div className={styles.place} ref={ref}>
{stack ? (
createPortal(<NodePanelInner node={node} stack />, document.body)
createPortal(
<NodePanelInner
node={node}
stack
onEdit={onEdit}
onLike={onLike}
can_edit={can_edit}
can_like={can_like}
/>,
document.body
)
) : (
<NodePanelInner node={node} />
<NodePanelInner
node={node}
onEdit={onEdit}
onLike={onLike}
can_edit={can_edit}
can_like={can_like}
/>
)}
</div>
);