"use client"; import Link from "next/link"; import { useEffect, useState } from "react"; import { fetchData } from "../utils/fetchData"; import { getApiUrl } from "../utils/getApiUrl"; import Carousel from "./Carousel"; import ReactMarkdown from "react-markdown"; interface ImageData { url: string; formats?: { large?: { url: string; }; }; name?: string; } interface ContentData { name: string; Resum: string; picture?: ImageData[]; link?: string; linkText?: string; } interface ContentSectionProps { collection: string; slug: string; titleClass?: string; contentClass?: string; } /** * Fiche détail portfolio — refonte "Digital Atelier" (étape 7.b). * * Structure : bouton retour + en-tête vellum (kicker + titre Manrope) + carousel * détail (Swiper Stitch) + corps Markdown en `prose` Newsreader + CTA jewel * optionnel vers le lien externe. Les props `titleClass` / `contentClass` * héritées du composant pré-refonte restent acceptées pour compatibilité mais * sont ignorées (styles tokenisés désormais) — on les garde dans l'interface * pour ne pas casser les consommateurs. */ export default function ContentSection({ collection, slug, }: ContentSectionProps) { const [data, setData] = useState(null); const [isLoading, setIsLoading] = useState(true); const apiUrl = getApiUrl(); useEffect(() => { async function fetchContent() { try { const result = await fetchData(collection, slug); setData(result); } finally { setIsLoading(false); } } fetchContent(); }, [collection, slug, apiUrl]); if (isLoading) { return (
); } if (!data) { return (

Ce projet est introuvable.

Retour au portfolio
); } const { name, Resum: richText, picture, link, linkText } = data; const images = picture?.map((img: ImageData) => ({ url: `${apiUrl}${img.formats?.large?.url || img.url}`, alt: img.name || `Visuel du projet ${name}`, })) || []; return (
{/* Bouton retour discret, posé sur le wallpaper comme une miette de fil d'Ariane. */} Portfolio {/* En-tête "feuillet de vellum" aligné sur la home et les listes. */}
Projet · Portfolio

{name}

{images.length > 0 && (
)} {richText && (
{richText}
)} {link && ( )}
); }