From 521e88f75a335c415ab178497310db0aa7e9c9aa Mon Sep 17 00:00:00 2001 From: RadoslavDimchev Date: Mon, 15 Apr 2024 11:59:37 +0300 Subject: [PATCH] feat(panel-wrapper): add closing and navigate from modal --- .../RightManagePanels/PanelWrapper.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pages/ManageValidator/RightManagePanels/PanelWrapper.tsx b/src/pages/ManageValidator/RightManagePanels/PanelWrapper.tsx index 6b63747c..d05aaeeb 100644 --- a/src/pages/ManageValidator/RightManagePanels/PanelWrapper.tsx +++ b/src/pages/ManageValidator/RightManagePanels/PanelWrapper.tsx @@ -1,8 +1,11 @@ import { Text } from '@status-im/components' import { useState } from 'react' import ReactModal from 'react-modal' +import { useNavigate, useParams } from 'react-router-dom' import { YStack } from 'tamagui' +import { PATHS } from '../../../constants' + type PanelWrapperProps = { children: React.ReactNode title: string @@ -10,9 +13,18 @@ type PanelWrapperProps = { const PanelWrapper = ({ children, title }: PanelWrapperProps) => { const [isModalOpen, setIsModalOpen] = useState(true) + const navigate = useNavigate() + const { validatorName } = useParams() + + const closeModal = () => { + setIsModalOpen(false) + navigate(`${PATHS.MANAGE_VALIDATOR}/${validatorName}`) + } + return (