From 5f3799ee75b3ac5cffe726023d8e5df129b919dd Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 13 May 2022 19:29:41 +0200 Subject: chore: add Thematic page --- src/pages/blog/index.tsx | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/pages/blog/index.tsx') diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index 05e73db..3acf6a9 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -24,6 +24,10 @@ import { } from '@ts/types/raw-data'; import { settings } from '@utils/config'; import { loadTranslation, type Messages } from '@utils/helpers/i18n'; +import { + getLinksListItems, + getPageLinkFromRawData, +} from '@utils/helpers/pages'; import usePagination from '@utils/hooks/use-pagination'; import useSettings from '@utils/hooks/use-settings'; import { GetStaticProps, NextPage } from 'next'; @@ -203,20 +207,6 @@ const BlogPage: NextPage = ({ setSize((prevSize) => prevSize + 1); }; - const getLinksListItems = ( - rawData: RawThematicPreview[] | RawTopicPreview[], - kind: 'thematic' | 'topic' - ): LinksListItems[] => { - const baseUrl = kind === 'thematic' ? '/thematique/' : '/sujet/'; - - return rawData.map((taxonomy) => { - return { - name: taxonomy.title, - url: `${baseUrl}${taxonomy.slug}`, - }; - }); - }; - const thematicsListTitle = intl.formatMessage({ defaultMessage: 'Thematics', description: 'BlogPage: thematics list widget title', @@ -251,13 +241,19 @@ const BlogPage: NextPage = ({ widgets={[ , , -- cgit v1.2.3