2025-02-13 17:30:45 +07:00

24 lines
591 B
TypeScript

import React from "react";
interface ModalProps {
isOpen: boolean; // Whether the modal is open or not
onClose: () => void; // Function to close the modal
children: React.ReactNode; // Content to be displayed inside the modal
}
const Modal: React.FC<ModalProps> = ({ isOpen, onClose, children }) => {
if (!isOpen) return null;
return (
<div className="modal-overlay">
<div className="modal-content">
<button className="modal-close" onClick={onClose}>
&times;
</button>
{children}
</div>
</div>
);
};
export default Modal;