Skip to content

Commit

Permalink
Utilisation du composant Accordion du DS
Browse files Browse the repository at this point in the history
  • Loading branch information
mariheck committed Apr 17, 2024
1 parent 96eea3f commit a359188
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 72 deletions.
32 changes: 32 additions & 0 deletions packages/site/app/faq/ListeQuestions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client';

import {Accordion} from '@tet/ui';
import {FaqData} from './page';
import Markdown from '@components/markdown/Markdown';

type ListeQuestionsProps = {
questions: FaqData[];
};

const ListeQuestions = ({questions}: ListeQuestionsProps) => {
return (
<div className="flex flex-col gap-4">
{questions.map(q => (
<div key={q.id}>
<Accordion
id={q.id.toString()}
title={q.titre}
content={
<Markdown
texte={q.contenu}
className="px-10 pt-6 border border-t-0 border-grey-4 rounded-b-lg"
/>
}
/>
</div>
))}
</div>
);
};

export default ListeQuestions;
17 changes: 3 additions & 14 deletions packages/site/app/faq/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use server';

import Accordion from '@components/accordion/Accordion';
import Section from '@components/sections/Section';
import {Metadata} from 'next';
import {fetchCollection} from 'src/strapi/strapi';
import {sortByRank} from 'src/utils/sortByRank';
import ContactEquipe from './ContactEquipe';
import ListeQuestions from './ListeQuestions';

export async function generateMetadata(): Promise<Metadata> {
return {
title: 'FAQ',
};
}

type FaqData = {
export type FaqData = {
id: number;
titre: string;
contenu: string;
Expand All @@ -40,18 +40,7 @@ const Faq = async () => {
<>
<Section>
<h1>Questions fréquentes</h1>
{questions && (
<div>
{questions.map(q => (
<Accordion
key={q.id}
id={q.id.toString()}
title={q.titre}
content={q.contenu}
/>
))}
</div>
)}
{questions && <ListeQuestions questions={questions} />}
</Section>
<ContactEquipe />
</>
Expand Down
25 changes: 17 additions & 8 deletions packages/site/app/outil-numerique/QuestionsPlateforme.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Accordion from '@components/accordion/Accordion';
'use client';

import Markdown from '@components/markdown/Markdown';
import Section from '@components/sections/Section';
import {Accordion} from '@tet/ui';

type QuestionsPlateformeProps = {
titre: string;
Expand All @@ -14,14 +17,20 @@ const QuestionsPlateforme = ({titre, liste}: QuestionsPlateformeProps) => {
return (
<Section containerClassName="bg-primary-0">
<h2 className="text-center">{titre}</h2>
<div>
<div className="flex flex-col gap-2">
{liste.map(l => (
<Accordion
key={l.id}
id={l.id.toString()}
title={l.titre}
content={l.contenu}
/>
<div key={l.id}>
<Accordion
id={l.id.toString()}
title={l.titre}
content={
<Markdown
texte={l.contenu}
className="px-10 pt-6 border border-t-0 border-grey-4 rounded-b-lg"
/>
}
/>
</div>
))}
</div>
</Section>
Expand Down
50 changes: 0 additions & 50 deletions packages/site/components/accordion/Accordion.tsx

This file was deleted.

0 comments on commit a359188

Please sign in to comment.