diff --git a/app/layout.tsx b/app/layout.tsx index 1405ff5..a4edd92 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -6,21 +6,21 @@ import "./assets/main.css"; import NavLink from "./components/NavLink"; export default function RootLayout({ children }) { - // Référence pour observer la taille du conteneur - const containerRef = useRef(null); + // Références pour observer le contenu de main + const contentRef = useRef(null); const [containerWidth, setContainerWidth] = useState("max-w-4xl"); const [containerHeight, setContainerHeight] = useState("min-h-[50vh]"); useEffect(() => { const observer = new ResizeObserver((entries) => { for (let entry of entries) { - const width = entry.contentRect.width; + const contentWidth = entry.contentRect.width; - if (width > 1400) { + if (contentWidth > 1400) { setContainerWidth("max-w-full"); - } else if (width > 1200) { + } else if (contentWidth > 1200) { setContainerWidth("max-w-6xl"); - } else if (width > 1000) { + } else if (contentWidth > 1000) { setContainerWidth("max-w-5xl"); } else { setContainerWidth("max-w-4xl"); @@ -28,11 +28,12 @@ export default function RootLayout({ children }) { } }); - if (containerRef.current) { - observer.observe(containerRef.current); + if (contentRef.current) { + observer.observe(contentRef.current); } + return () => observer.disconnect(); - }, []); + }, [children]); // 🔄 Recalculer à chaque mise à jour des enfants return ( @@ -44,7 +45,7 @@ export default function RootLayout({ children }) {
- + {/* En-tête avec navigation */}
@@ -60,13 +61,13 @@ export default function RootLayout({ children }) {
- {/* Conteneur principal avec ajustement dynamique et scroll horizontal si nécessaire */} + {/* Conteneur principal ajusté dynamiquement */}
-
- {children} +
+ {/* 🎯 On observe ce div plutôt que main */} +
+ {children} +
diff --git a/app/portfolio/page.jsx b/app/portfolio/page.jsx index fa24aaa..27e9eeb 100644 --- a/app/portfolio/page.jsx +++ b/app/portfolio/page.jsx @@ -30,7 +30,7 @@ export default async function Page() { } return ( -
+
{/* Titre de la page */}

Portfolio formation 42