21 lines
710 B
TypeScript
21 lines
710 B
TypeScript
import Icon, { ICONS } from "./Icon";
|
|
|
|
interface ModalProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export default function Modal({ isOpen, onClose, children }: ModalProps) {
|
|
if (!isOpen) return null;
|
|
return (
|
|
<div className="fixed inset-0 bg-black bg-opacity-50 z-50 flex justify-center items-center p-4">
|
|
<div className="bg-white rounded-lg shadow-xl w-full max-w-md p-6 relative">
|
|
<button onClick={onClose} className="absolute top-3 right-3 text-gray-400 hover:text-gray-600">
|
|
<Icon path={ICONS.close} />
|
|
</button>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
}; |