MSP-3134 move folders
This commit is contained in:
1 parent
ab902d855e
commit
ec02fb7af0
7 files changed
+91
-73
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import { Button } from 'antd'
|
||||
import { Dispatch, MouseEvent, ReactNode, SetStateAction } from 'react'
|
||||
import CloseBtn from 'src/ui/CloseBtn'
|
||||
|
||||
import './modal.scss'
|
||||
|
||||
interface ModalPropsType {
|
||||
onOk?: () => void
|
||||
title: string
|
||||
children: ReactNode
|
||||
setIsOpenModal: Dispatch<SetStateAction<boolean>>
|
||||
footer?: { onOkText: string; onCanselText: string }
|
||||
}
|
||||
|
||||
const Modal = ({
|
||||
onOk,
|
||||
footer,
|
||||
title,
|
||||
children,
|
||||
setIsOpenModal
|
||||
}: ModalPropsType) => {
|
||||
const closeModal = () => {
|
||||
setIsOpenModal(false)
|
||||
}
|
||||
|
||||
const handleModalClick = (event: MouseEvent<HTMLDivElement>) => {
|
||||
event.stopPropagation()
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="modal" onClick={closeModal}>
|
||||
<div className="modal__wrap" onClick={handleModalClick}>
|
||||
<h1 className="modal__title">{title}</h1>
|
||||
<div className="modal__content">{children}</div>
|
||||
{footer && (
|
||||
<div className="modal__footer">
|
||||
<Button type="default" onClick={closeModal}>
|
||||
{footer.onCanselText}
|
||||
</Button>
|
||||
<Button type="default" onClick={onOk}>
|
||||
{footer.onOkText}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<CloseBtn onClick={closeModal} ariaLabel="close" />
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default Modal
|
||||
Reference in new issue
Block a user