mirror of
https://github.com/status-im/nimbus-gui.git
synced 2025-01-22 09:19:28 +00:00
feat(panel-wrapper): add closing and navigate from modal
This commit is contained in:
parent
624218b104
commit
521e88f75a
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user