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 } }) {
|
||||
console.log("🛠️ Paramètres reçus :", params.slug);
|
||||
return <ContentSectionCompetences collection="competences" slug={params.slug} />;
|
||||
export default function CompetencePage({ params }: { params: { slug: string } }) {
|
||||
return <ContentSectionCompetencesContainer 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 ReactMarkdown from "react-markdown";
|
||||
import { useState, useEffect } from "react";
|
||||
import ModalGlossaire from "./ModalGlossaire"; // ✅ Import de la modale
|
||||
import ModalGlossaire from "./ModalGlossaire";
|
||||
|
||||
interface ContentSectionProps {
|
||||
collection: string;
|
||||
slug: string;
|
||||
competenceData: any;
|
||||
glossaireData: any[];
|
||||
titleClass?: string;
|
||||
contentClass?: string;
|
||||
}
|
||||
@ -22,17 +21,14 @@ interface GlossaireItem {
|
||||
images?: any[];
|
||||
}
|
||||
|
||||
export default async function ContentSectionCompetences({ collection, slug, titleClass, contentClass }: ContentSectionProps) {
|
||||
const data = await fetchDataCompetences(collection, slug);
|
||||
const glossaireData: GlossaireItem[] = await fetchDataGlossaire();
|
||||
|
||||
export default function ContentSectionCompetences({ competenceData, glossaireData, titleClass, contentClass }: ContentSectionProps) {
|
||||
const [selectedMot, setSelectedMot] = useState<GlossaireItem | null>(null);
|
||||
|
||||
if (!data) {
|
||||
if (!competenceData) {
|
||||
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) => ({
|
||||
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