"use client"; import React, { useEffect, useState, useRef } from "react"; import Footer from "./components/Footer"; import "./assets/main.css"; import NavLink from "./components/NavLink"; export default function RootLayout({ children }) { const containerRef = useRef(null); const [containerWidth, setContainerWidth] = useState("w-full"); // ✅ Par défaut pleine largeur const [containerHeight, setContainerHeight] = useState("min-h-[50vh]"); useEffect(() => { if (!containerRef.current) return; const childCount = containerRef.current.children.length; // 📌 Compte le nombre d'enfants // 📌 Ajuster la largeur UNIQUEMENT si peu d'éléments if (childCount <= 2) { setContainerWidth("max-w-3xl"); // ✅ Rétrécir pour la home ou peu de contenu } else { setContainerWidth("w-full"); // ✅ Sinon pleine largeur } // 📌 Ajuster la hauteur dynamiquement const observer = new ResizeObserver((entries) => { for (let entry of entries) { const contentHeight = entry.contentRect.height; if (contentHeight > 800) { setContainerHeight("min-h-[90vh]"); } else if (contentHeight > 600) { setContainerHeight("min-h-[80vh]"); } else if (contentHeight > 400) { setContainerHeight("min-h-[70vh]"); } else { setContainerHeight("min-h-[50vh]"); } } }); observer.observe(containerRef.current); return () => observer.disconnect(); }, [children]); return (

Portfolio Gras-Calvet Fernand

{children}
); }