|
| 1 | +/* |
| 2 | + Copyright (C) 2022 Krishna Mahato ([email protected]) |
| 3 | +
|
| 4 | + SPDX-License-Identifier: GPL-2.0 |
| 5 | +
|
| 6 | + This program is free software; you can redistribute it and/or |
| 7 | + modify it under the terms of the GNU General Public License |
| 8 | + version 2 as published by the Free Software Foundation. |
| 9 | + This program is distributed in the hope that it will be useful, |
| 10 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + GNU General Public License for more details. |
| 13 | +
|
| 14 | + You should have received a copy of the GNU General Public License along |
| 15 | + with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | +*/ |
| 18 | + |
| 19 | +import PropTypes from "prop-types"; |
| 20 | +import React from "react"; |
| 21 | +import { Button } from ".."; |
| 22 | + |
| 23 | +// css |
| 24 | +import "./index.css"; |
| 25 | + |
| 26 | +const Modal = ({ show, setShow, children }) => { |
| 27 | + return ( |
| 28 | + show && ( |
| 29 | + <div className="modal-container"> |
| 30 | + <div className="modal-body"> |
| 31 | + {children} |
| 32 | + <Button |
| 33 | + className="bg-light border text-dark" |
| 34 | + type="button" |
| 35 | + onClick={() => setShow(false)} |
| 36 | + > |
| 37 | + Close |
| 38 | + </Button> |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + ) |
| 42 | + ); |
| 43 | +}; |
| 44 | + |
| 45 | +Modal.propTypes = { |
| 46 | + show: PropTypes.bool.isRequired, |
| 47 | + setShow: PropTypes.func.isRequired, |
| 48 | + children: PropTypes.element, |
| 49 | +}; |
| 50 | + |
| 51 | +export default Modal; |
0 commit comments