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
|
||||
@@ -0,0 +1,47 @@
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
background-color: rgba(211, 211, 211, 0.8);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 100;
|
||||
&__wrap {
|
||||
min-width: 310px;
|
||||
min-height: 170px;
|
||||
background: white;
|
||||
color: white;
|
||||
z-index: 10;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 5px 20px 0 rgba(0, 0, 0, 0.04);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__header {
|
||||
height: 50px;
|
||||
background: white;
|
||||
overflow: hidden;
|
||||
border-top-left-radius: 16px;
|
||||
border-top-right-radius: 16px;
|
||||
}
|
||||
&__content {
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
color: #2c3e50;
|
||||
text-align: center;
|
||||
}
|
||||
&__footer {
|
||||
position: absolute;
|
||||
bottom: 8px;
|
||||
right: 16px;
|
||||
button:first-child {
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user