-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modal.jsx
32 lines (29 loc) · 823 Bytes
/
Modal.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import ReactDOM from 'react-dom';
import React, { useState} from "react";
import { useNavigate } from 'react-router-dom';
import Button from "./Button";
const Modal = ({ show, content, onCloseButtonClick, subUrl}) => {
//let history = useHistory();
const navigate = useNavigate();
if (!show) {
window.history.replaceState(null, "", "/");
return null;
} else {
window.history.replaceState(null, "", "/" + subUrl);
}
return ReactDOM.createPortal(
<div className="modal-wrapper">
<div className="modal">
<div className="body">
{content}
<br /><br /><br />
</div>
<div className="footer">
<button onClick={onCloseButtonClick}>닫기</button>
</div>
</div>
</div>
, document.body
);
};
export default Modal;