feat(panel-wrapper): add closing and navigate from modal

This commit is contained in:
RadoslavDimchev 2024-04-15 11:59:37 +03:00 committed by Radoslav Dimchev
parent 624218b104
commit 521e88f75a

View File

@ -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 (
<ReactModal
isOpen={isModalOpen}
onRequestClose={closeModal}
style={{
content: {
borderRadius: '12px',