Refactor modal implementation across admin components: Replace Card components with a reusable Modal component in ChallengeManagement, EventManagement, and UserManagement, enhancing UI consistency and maintainability. Update Modal to use React portals for improved rendering.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { ReactNode, useEffect } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
interface ModalProps {
|
||||
isOpen: boolean;
|
||||
@@ -37,7 +38,7 @@ export default function Modal({
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
return (
|
||||
const modalContent = (
|
||||
<div
|
||||
className="fixed inset-0 z-[200] flex items-center justify-center p-4 backdrop-blur-sm"
|
||||
style={{
|
||||
@@ -59,4 +60,11 @@ export default function Modal({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
// Utiliser un portal pour rendre le modal directement dans le body
|
||||
if (typeof window !== "undefined") {
|
||||
return createPortal(modalContent, document.body);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user