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:
Julien Froidefond
2025-12-16 16:50:06 +01:00
parent 16e4b63ffd
commit 79c21955e0
4 changed files with 720 additions and 662 deletions

View File

@@ -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;
}