mirror of
https://github.com/Ladebeze66/devsite.git
synced 2026-02-04 03:30:21 +01:00
glossairenext
This commit is contained in:
parent
2b83679a02
commit
add864a4e0
@ -1,6 +1,5 @@
|
|||||||
import ContentSectionCompetences from "../../components/ContentSectionCompetences";
|
import ContentSectionCompetencesContainer from "../../components/ContentSectionCompetencesContainer";
|
||||||
|
|
||||||
export default function Page({ params }: { params: { slug: string } }) {
|
export default function CompetencePage({ params }: { params: { slug: string } }) {
|
||||||
console.log("🛠️ Paramètres reçus :", params.slug);
|
return <ContentSectionCompetencesContainer collection="competences" slug={params.slug} />;
|
||||||
return <ContentSectionCompetences collection="competences" slug={params.slug} />;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,13 @@
|
|||||||
"use client";
|
"use client"; // ✅ Ajout pour en faire un Client Component
|
||||||
|
|
||||||
import { fetchDataCompetences, fetchDataGlossaire } from "../utils/fetchDataCompetences";
|
import { useState, useEffect } from "react";
|
||||||
import CarouselCompetences from "./CarouselCompetences";
|
import CarouselCompetences from "./CarouselCompetences";
|
||||||
import ReactMarkdown from "react-markdown";
|
import ReactMarkdown from "react-markdown";
|
||||||
import { useState, useEffect } from "react";
|
import ModalGlossaire from "./ModalGlossaire";
|
||||||
import ModalGlossaire from "./ModalGlossaire"; // ✅ Import de la modale
|
|
||||||
|
|
||||||
interface ContentSectionProps {
|
interface ContentSectionProps {
|
||||||
collection: string;
|
competenceData: any;
|
||||||
slug: string;
|
glossaireData: any[];
|
||||||
titleClass?: string;
|
titleClass?: string;
|
||||||
contentClass?: string;
|
contentClass?: string;
|
||||||
}
|
}
|
||||||
@ -22,17 +21,14 @@ interface GlossaireItem {
|
|||||||
images?: any[];
|
images?: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function ContentSectionCompetences({ collection, slug, titleClass, contentClass }: ContentSectionProps) {
|
export default function ContentSectionCompetences({ competenceData, glossaireData, titleClass, contentClass }: ContentSectionProps) {
|
||||||
const data = await fetchDataCompetences(collection, slug);
|
|
||||||
const glossaireData: GlossaireItem[] = await fetchDataGlossaire();
|
|
||||||
|
|
||||||
const [selectedMot, setSelectedMot] = useState<GlossaireItem | null>(null);
|
const [selectedMot, setSelectedMot] = useState<GlossaireItem | null>(null);
|
||||||
|
|
||||||
if (!data) {
|
if (!competenceData) {
|
||||||
return <div className="text-red-500 text-center">❌ Compétence introuvable.</div>;
|
return <div className="text-red-500 text-center">❌ Compétence introuvable.</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name, content, picture } = data;
|
const { name, content, picture } = competenceData;
|
||||||
|
|
||||||
const images = picture?.map((img: any) => ({
|
const images = picture?.map((img: any) => ({
|
||||||
url: `http://localhost:1337${img?.formats?.large?.url || img?.url}`,
|
url: `http://localhost:1337${img?.formats?.large?.url || img?.url}`,
|
||||||
|
|||||||
23
app/components/ContentSectionCompetencesContainer.tsx
Normal file
23
app/components/ContentSectionCompetencesContainer.tsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { fetchDataCompetences, fetchDataGlossaire } from "../utils/fetchDataCompetences";
|
||||||
|
import ContentSectionCompetences from "./ContentSectionCompetences";
|
||||||
|
|
||||||
|
interface ContentSectionProps {
|
||||||
|
collection: string;
|
||||||
|
slug: string;
|
||||||
|
titleClass?: string;
|
||||||
|
contentClass?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function ContentSectionCompetencesContainer({ collection, slug, titleClass, contentClass }: ContentSectionProps) {
|
||||||
|
const competenceData = await fetchDataCompetences(collection, slug);
|
||||||
|
const glossaireData = await fetchDataGlossaire();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ContentSectionCompetences
|
||||||
|
competenceData={competenceData}
|
||||||
|
glossaireData={glossaireData}
|
||||||
|
titleClass={titleClass}
|
||||||
|
contentClass={contentClass}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user