24 lines
591 B
TypeScript
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}>
|
|
×
|
|
</button>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Modal;
|