Loading problem…
This problem builds on modal. Complete that first, then load your solution to continue.
Build an enhanced Modal component with smooth animations and support for nested modals.
interface ModalProps {
isOpen: boolean;
onClose: () => void;
title?: string;
children: React.ReactNode;
size?: "sm" | "md" | "lg" | "fullscreen";
animationType?: "fade" | "slide" | "scale";
animationDuration?: number;
allowNested?: boolean;
}<Modal
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Parent Modal"
size="md"
animationType="slide"
>
<button onClick={() => setNestedOpen(true)}>Open Nested Modal</button>
<Modal
isOpen={nestedOpen}
onClose={() => setNestedOpen(false)}
title="Nested Modal"
size="sm"
>
<p>This is a nested modal!</p>
</Modal>
</Modal>