mirror of
https://github.com/sasjs/server.git
synced 2026-01-03 21:10:05 +00:00
chore(web): refactor react code
This commit is contained in:
19
web/src/utils/hooks/useModal.tsx
Normal file
19
web/src/utils/hooks/useModal.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useState } from 'react'
|
||||
import Modal from '../../components/modal'
|
||||
|
||||
export const useModal = () => {
|
||||
const [openModal, setOpenModal] = useState(false)
|
||||
const [modalTitle, setModalTitle] = useState('')
|
||||
const [modalPayload, setModalPayload] = useState('')
|
||||
|
||||
const Dialog = () => (
|
||||
<Modal
|
||||
open={openModal}
|
||||
setOpen={setOpenModal}
|
||||
title={modalTitle}
|
||||
payload={modalPayload}
|
||||
/>
|
||||
)
|
||||
|
||||
return { Dialog, setOpenModal, setModalTitle, setModalPayload }
|
||||
}
|
||||
Reference in New Issue
Block a user