diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-09-20 16:38:54 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-09-20 16:38:54 +0200 |
| commit | f861e6a269ba9f62700776d3cd13b644a9e836d4 (patch) | |
| tree | a5a107e7a6e4ff8b4261fe04349357bc00b783ee /src/pages | |
| parent | 03331c44276ec56e9f235e4d5ee75030455a753f (diff) | |
refactor: use named export for everything except pages
Next expect a default export for pages so only those components should
use default exports. Everything else should use named exports to
reduce the number of import statements.
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/404.tsx | 31 | ||||
| -rw-r--r-- | src/pages/_app.tsx | 5 | ||||
| -rw-r--r-- | src/pages/article/[slug].tsx | 42 | ||||
| -rw-r--r-- | src/pages/atom.xml.tsx | 2 | ||||
| -rw-r--r-- | src/pages/blog/index.tsx | 39 | ||||
| -rw-r--r-- | src/pages/blog/page/[number].tsx | 42 | ||||
| -rw-r--r-- | src/pages/contact.tsx | 25 | ||||
| -rw-r--r-- | src/pages/cv.tsx | 26 | ||||
| -rw-r--r-- | src/pages/feed.json.tsx | 2 | ||||
| -rw-r--r-- | src/pages/feed.xml.tsx | 2 | ||||
| -rw-r--r-- | src/pages/index.tsx | 48 | ||||
| -rw-r--r-- | src/pages/mentions-legales.tsx | 20 | ||||
| -rw-r--r-- | src/pages/projets/[slug].tsx | 56 | ||||
| -rw-r--r-- | src/pages/projets/index.tsx | 25 | ||||
| -rw-r--r-- | src/pages/recherche/index.tsx | 45 | ||||
| -rw-r--r-- | src/pages/sujet/[slug].tsx | 28 | ||||
| -rw-r--r-- | src/pages/thematique/[slug].tsx | 26 |
17 files changed, 231 insertions, 233 deletions
diff --git a/src/pages/404.tsx b/src/pages/404.tsx index a6d84f5..5dff404 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -2,28 +2,27 @@ import { GetStaticProps } from 'next'; import Head from 'next/head'; import { ReactNode } from 'react'; import { useIntl } from 'react-intl'; -import Link from '../components/atoms/links/link'; -import SearchForm from '../components/organisms/forms/search-form'; -import LinksListWidget from '../components/organisms/widgets/links-list-widget'; -import { getLayout } from '../components/templates/layout/layout'; -import PageLayout from '../components/templates/page/page-layout'; +import { + getLayout, + Link, + LinksListWidget, + PageLayout, + SearchForm, +} from '../components'; import { getThematicsPreview, + getTopicsPreview, getTotalThematics, -} from '../services/graphql/thematics'; -import { getTopicsPreview, getTotalTopics } from '../services/graphql/topics'; -import { type NextPageWithLayout } from '../types/app'; + getTotalTopics, +} from '../services/graphql'; import { + type NextPageWithLayout, type RawThematicPreview, type RawTopicPreview, -} from '../types/raw-data'; -import { loadTranslation, type Messages } from '../utils/helpers/i18n'; -import { - getLinksListItems, - getPageLinkFromRawData, -} from '../utils/helpers/pages'; -import useBreadcrumb from '../utils/hooks/use-breadcrumb'; -import useSettings from '../utils/hooks/use-settings'; +} from '../types'; +import { getLinksListItems, getPageLinkFromRawData } from '../utils/helpers'; +import { loadTranslation, type Messages } from '../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../utils/hooks'; type Error404PageProps = { thematicsList: RawThematicPreview[]; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index f6eb88e..0fb17f4 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -2,10 +2,9 @@ import { ThemeProvider } from 'next-themes'; import { useRouter } from 'next/router'; import { IntlProvider } from 'react-intl'; import '../styles/globals.scss'; -import { type AppPropsWithLayout } from '../types/app'; +import { type AppPropsWithLayout } from '../types'; import { settings } from '../utils/config'; -import { AckeeProvider } from '../utils/providers/ackee'; -import { PrismThemeProvider } from '../utils/providers/prism-theme'; +import { AckeeProvider, PrismThemeProvider } from '../utils/providers'; const App = ({ Component, pageProps }: AppPropsWithLayout) => { const { locale, defaultLocale } = useRouter(); diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index dae89fb..f564f35 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -5,41 +5,43 @@ import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { HTMLAttributes } from 'react'; import { useIntl } from 'react-intl'; -import ButtonLink from '../../components/atoms/buttons/button-link'; -import Link from '../../components/atoms/links/link'; -import Spinner from '../../components/atoms/loaders/spinner'; -import ResponsiveImage from '../../components/molecules/images/responsive-image'; -import Sharing from '../../components/organisms/widgets/sharing'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout, { +import { + ButtonLink, + getLayout, + Link, + PageLayout, type PageLayoutProps, -} from '../../components/templates/page/page-layout'; + ResponsiveImage, + Sharing, + Spinner, +} from '../../components'; import { getAllArticlesSlugs, + getAllComments, getArticleBySlug, -} from '../../services/graphql/articles'; -import { getAllComments } from '../../services/graphql/comments'; +} from '../../services/graphql'; import styles from '../../styles/pages/article.module.scss'; import { type Article, type NextPageWithLayout, type SingleComment, -} from '../../types/app'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; +} from '../../types'; import { getBlogSchema, getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import useArticle from '../../utils/hooks/use-article'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import useComments from '../../utils/hooks/use-comments'; -import usePrism, { +} from '../../utils/helpers'; +import { loadTranslation, type Messages } from '../../utils/helpers/server'; +import { type OptionalPrismPlugin, -} from '../../utils/hooks/use-prism'; -import useReadingTime from '../../utils/hooks/use-reading-time'; -import useSettings from '../../utils/hooks/use-settings'; + useArticle, + useBreadcrumb, + useComments, + usePrism, + useReadingTime, + useSettings, +} from '../../utils/hooks'; type ArticlePageProps = { comments: SingleComment[]; diff --git a/src/pages/atom.xml.tsx b/src/pages/atom.xml.tsx index 580830a..4515fdd 100644 --- a/src/pages/atom.xml.tsx +++ b/src/pages/atom.xml.tsx @@ -1,5 +1,5 @@ import { GetServerSideProps } from 'next'; -import { generateFeed } from '../utils/helpers/rss'; +import { generateFeed } from '../utils/helpers'; const Feed = () => null; diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index 1f88588..13a4c57 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -3,42 +3,39 @@ import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; import { useIntl } from 'react-intl'; -import Notice from '../../components/atoms/layout/notice'; -import PostsList from '../../components/organisms/layout/posts-list'; -import LinksListWidget from '../../components/organisms/widgets/links-list-widget'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout from '../../components/templates/page/page-layout'; -import { getArticles, getTotalArticles } from '../../services/graphql/articles'; import { - getThematicsPreview, - getTotalThematics, -} from '../../services/graphql/thematics'; + getLayout, + LinksListWidget, + Notice, + PageLayout, + PostsList, +} from '../../components'; import { + getArticles, + getThematicsPreview, getTopicsPreview, + getTotalArticles, + getTotalThematics, getTotalTopics, -} from '../../services/graphql/topics'; -import { type NextPageWithLayout } from '../../types/app'; -import { EdgesResponse } from '../../types/graphql/queries'; +} from '../../services/graphql'; import { + type EdgesResponse, + type NextPageWithLayout, type RawArticle, type RawThematicPreview, type RawTopicPreview, -} from '../../types/raw-data'; +} from '../../types'; import { settings } from '../../utils/config'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; import { + getBlogSchema, getLinksListItems, getPageLinkFromRawData, getPostsList, -} from '../../utils/helpers/pages'; -import { - getBlogSchema, getSchemaJson, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import usePagination from '../../utils/hooks/use-pagination'; -import useSettings from '../../utils/hooks/use-settings'; +} from '../../utils/helpers'; +import { loadTranslation, type Messages } from '../../utils/helpers/server'; +import { useBreadcrumb, usePagination, useSettings } from '../../utils/hooks'; type BlogPageProps = { articles: EdgesResponse<RawArticle>; diff --git a/src/pages/blog/page/[number].tsx b/src/pages/blog/page/[number].tsx index bfd9953..4eaade5 100644 --- a/src/pages/blog/page/[number].tsx +++ b/src/pages/blog/page/[number].tsx @@ -4,45 +4,43 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { useIntl } from 'react-intl'; -import PostsList from '../../../components/organisms/layout/posts-list'; -import LinksListWidget from '../../../components/organisms/widgets/links-list-widget'; -import { getLayout } from '../../../components/templates/layout/layout'; -import PageLayout from '../../../components/templates/page/page-layout'; +import { + getLayout, + LinksListWidget, + PageLayout, + PostsList, +} from '../../../components'; import { getArticles, getArticlesEndCursor, - getTotalArticles, -} from '../../../services/graphql/articles'; -import { getThematicsPreview, - getTotalThematics, -} from '../../../services/graphql/thematics'; -import { getTopicsPreview, + getTotalArticles, + getTotalThematics, getTotalTopics, -} from '../../../services/graphql/topics'; -import { type NextPageWithLayout } from '../../../types/app'; -import { EdgesResponse } from '../../../types/graphql/queries'; +} from '../../../services/graphql'; import { + type EdgesResponse, + type NextPageWithLayout, type RawArticle, type RawThematicPreview, type RawTopicPreview, -} from '../../../types/raw-data'; +} from '../../../types'; import { settings } from '../../../utils/config'; -import { loadTranslation, type Messages } from '../../../utils/helpers/i18n'; import { + getBlogSchema, getLinksListItems, getPageLinkFromRawData, getPostsList, -} from '../../../utils/helpers/pages'; -import { - getBlogSchema, getSchemaJson, getWebPageSchema, -} from '../../../utils/helpers/schema-org'; -import useBreadcrumb from '../../../utils/hooks/use-breadcrumb'; -import useRedirection from '../../../utils/hooks/use-redirection'; -import useSettings from '../../../utils/hooks/use-settings'; +} from '../../../utils/helpers'; +import { loadTranslation, type Messages } from '../../../utils/helpers/server'; +import { + useBreadcrumb, + useRedirection, + useSettings, +} from '../../../utils/hooks'; type BlogPageProps = { articles: EdgesResponse<RawArticle>; diff --git a/src/pages/contact.tsx b/src/pages/contact.tsx index b35b8e0..e3c8a2c 100644 --- a/src/pages/contact.tsx +++ b/src/pages/contact.tsx @@ -4,25 +4,26 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import { useState } from 'react'; import { useIntl } from 'react-intl'; -import Notice, { type NoticeKind } from '../components/atoms/layout/notice'; -import ContactForm, { +import { + ContactForm, type ContactFormProps, -} from '../components/organisms/forms/contact-form'; -import SocialMedia from '../components/organisms/widgets/social-media'; -import { getLayout } from '../components/templates/layout/layout'; -import PageLayout from '../components/templates/page/page-layout'; + getLayout, + Notice, + type NoticeKind, + PageLayout, + SocialMedia, +} from '../components'; import { meta } from '../content/pages/contact.mdx'; -import { sendMail } from '../services/graphql/contact'; +import { sendMail } from '../services/graphql'; import styles from '../styles/pages/contact.module.scss'; -import { type NextPageWithLayout } from '../types/app'; -import { loadTranslation } from '../utils/helpers/i18n'; +import { type NextPageWithLayout } from '../types'; import { getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../utils/helpers/schema-org'; -import useBreadcrumb from '../utils/hooks/use-breadcrumb'; -import useSettings from '../utils/hooks/use-settings'; +} from '../utils/helpers'; +import { loadTranslation } from '../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../utils/hooks'; const ContactPage: NextPageWithLayout = () => { const { dates, intro, seo, title } = meta; diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index 9e01e2f..9e1e7db 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -5,26 +5,26 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import React, { AnchorHTMLAttributes, HTMLAttributes, ReactNode } from 'react'; import { useIntl } from 'react-intl'; -import Heading from '../components/atoms/headings/heading'; -import Link from '../components/atoms/links/link'; -import List from '../components/atoms/lists/list'; -import ImageWidget from '../components/organisms/widgets/image-widget'; -import SocialMedia from '../components/organisms/widgets/social-media'; -import { getLayout } from '../components/templates/layout/layout'; -import PageLayout, { +import { + getLayout, + Heading, + ImageWidget, + Link, + List, + PageLayout, type PageLayoutProps, -} from '../components/templates/page/page-layout'; + SocialMedia, +} from '../components'; import CVContent, { data, meta } from '../content/pages/cv.mdx'; import styles from '../styles/pages/cv.module.scss'; -import { type NextPageWithLayout } from '../types/app'; -import { loadTranslation } from '../utils/helpers/i18n'; +import { type NextPageWithLayout } from '../types'; import { getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../utils/helpers/schema-org'; -import useBreadcrumb from '../utils/hooks/use-breadcrumb'; -import useSettings from '../utils/hooks/use-settings'; +} from '../utils/helpers'; +import { loadTranslation } from '../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../utils/hooks'; const ExternalLink = ({ children = '', diff --git a/src/pages/feed.json.tsx b/src/pages/feed.json.tsx index f240464..7c77e19 100644 --- a/src/pages/feed.json.tsx +++ b/src/pages/feed.json.tsx @@ -1,5 +1,5 @@ import { GetServerSideProps } from 'next'; -import { generateFeed } from '../utils/helpers/rss'; +import { generateFeed } from '../utils/helpers'; const Feed = () => null; diff --git a/src/pages/feed.xml.tsx b/src/pages/feed.xml.tsx index 79c7f41..60dcb21 100644 --- a/src/pages/feed.xml.tsx +++ b/src/pages/feed.xml.tsx @@ -1,5 +1,5 @@ import { GetServerSideProps } from 'next'; -import { generateFeed } from '../utils/helpers/rss'; +import { generateFeed } from '../utils/helpers'; const Feed = () => null; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 291d011..8c357f1 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -2,30 +2,31 @@ import { MDXComponents } from 'mdx/types'; import { GetStaticProps } from 'next'; import Head from 'next/head'; import Script from 'next/script'; -import { ReactElement } from 'react'; +import { ReactNode, isValidElement } from 'react'; import { useIntl } from 'react-intl'; import FeedIcon from '../assets/images/icon-feed.svg'; -import ButtonLink from '../components/atoms/buttons/button-link'; -import Envelop from '../components/atoms/icons/envelop'; -import Column from '../components/atoms/layout/column'; -import Section, { type SectionProps } from '../components/atoms/layout/section'; -import List, { type ListItem } from '../components/atoms/lists/list'; -import ResponsiveImage from '../components/molecules/images/responsive-image'; -import Columns, { - type ColumnsProps, -} from '../components/molecules/layout/columns'; -import CardsList, { +import { + ButtonLink, + CardsList, type CardsListItem, -} from '../components/organisms/layout/cards-list'; -import { getLayout } from '../components/templates/layout/layout'; + Column, + Columns, + type ColumnsProps, + Envelop, + getLayout, + List, + type ListItem, + ResponsiveImage, + Section, + type SectionProps, +} from '../components'; import HomePageContent from '../content/pages/homepage.mdx'; -import { getArticlesCard } from '../services/graphql/articles'; +import { getArticlesCard } from '../services/graphql'; import styles from '../styles/pages/home.module.scss'; -import { type ArticleCard, type NextPageWithLayout } from '../types/app'; -import { loadTranslation, type Messages } from '../utils/helpers/i18n'; -import { getSchemaJson, getWebPageSchema } from '../utils/helpers/schema-org'; -import useBreadcrumb from '../utils/hooks/use-breadcrumb'; -import useSettings from '../utils/hooks/use-settings'; +import { type ArticleCard, type NextPageWithLayout } from '../types'; +import { getSchemaJson, getWebPageSchema } from '../utils/helpers'; +import { loadTranslation, type Messages } from '../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../utils/hooks'; /** * Retrieve a list of coding links. @@ -259,25 +260,24 @@ const HomePage: NextPageWithLayout<HomeProps> = ({ recentPosts }) => { * Create the page sections. * * @param {object} obj - An object containing the section body. - * @param {ReactElement[]} obj.children - The section body. + * @param {ReactNode[]} obj.children - The section body. * @returns {JSX.Element} A section element. */ const getSection = ({ children, variant, }: { - children: ReactElement[]; + children: ReactNode[]; variant: SectionProps['variant']; }): JSX.Element => { const [headingEl, ...content] = children; - const title = headingEl.props.children; return ( <Section - title={title} + className={styles.section} content={content} + title={isValidElement(headingEl) ? headingEl.props.children : ''} variant={variant} - className={styles.section} /> ); }; diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx index 49363dc..faf76b1 100644 --- a/src/pages/mentions-legales.tsx +++ b/src/pages/mentions-legales.tsx @@ -3,22 +3,22 @@ import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; -import Link from '../components/atoms/links/link'; -import ResponsiveImage from '../components/molecules/images/responsive-image'; -import { getLayout } from '../components/templates/layout/layout'; -import PageLayout, { +import { + getLayout, + Link, + PageLayout, type PageLayoutProps, -} from '../components/templates/page/page-layout'; + ResponsiveImage, +} from '../components'; import LegalNoticeContent, { meta } from '../content/pages/legal-notice.mdx'; -import { type NextPageWithLayout } from '../types/app'; -import { loadTranslation } from '../utils/helpers/i18n'; +import { type NextPageWithLayout } from '../types'; import { getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../utils/helpers/schema-org'; -import useBreadcrumb from '../utils/hooks/use-breadcrumb'; -import useSettings from '../utils/hooks/use-settings'; +} from '../utils/helpers'; +import { loadTranslation } from '../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../utils/hooks'; /** * Legal Notice page. diff --git a/src/pages/projets/[slug].tsx b/src/pages/projets/[slug].tsx index eb007bb..ba03d9b 100644 --- a/src/pages/projets/[slug].tsx +++ b/src/pages/projets/[slug].tsx @@ -6,44 +6,46 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import { ComponentType } from 'react'; import { useIntl } from 'react-intl'; -import Link from '../../components/atoms/links/link'; -import SocialLink, { - type SocialWebsite, -} from '../../components/atoms/links/social-link'; -import Spinner from '../../components/atoms/loaders/spinner'; -import ResponsiveImage, { - ResponsiveImageProps, -} from '../../components/molecules/images/responsive-image'; -import Code from '../../components/molecules/layout/code'; -import Gallery from '../../components/organisms/images/gallery'; -import Overview, { +import { + Code, + Gallery, + getLayout, + Link, + Overview, type OverviewMeta, -} from '../../components/organisms/layout/overview'; -import Sharing from '../../components/organisms/widgets/sharing'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout, { + PageLayout, type PageLayoutProps, -} from '../../components/templates/page/page-layout'; + ResponsiveImage, + type ResponsiveImageProps, + Sharing, + SocialLink, + type SocialWebsite, + Spinner, +} from '../../components'; import styles from '../../styles/pages/project.module.scss'; import { type NextPageWithLayout, type ProjectPreview, type Repos, -} from '../../types/app'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; -import { - getProjectData, - getProjectFilenames, -} from '../../utils/helpers/projects'; +} from '../../types'; import { + capitalize, getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import { capitalize } from '../../utils/helpers/strings'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import useGithubApi, { type RepoData } from '../../utils/hooks/use-github-api'; -import useSettings from '../../utils/hooks/use-settings'; +} from '../../utils/helpers'; +import { + getProjectData, + getProjectFilenames, + loadTranslation, + type Messages, +} from '../../utils/helpers/server'; +import { + type RepoData, + useBreadcrumb, + useGithubApi, + useSettings, +} from '../../utils/hooks'; const BorderedImage = (props: ResponsiveImageProps) => { return <ResponsiveImage withBorders={true} {...props} />; diff --git a/src/pages/projets/index.tsx b/src/pages/projets/index.tsx index 22a5346..a145401 100644 --- a/src/pages/projets/index.tsx +++ b/src/pages/projets/index.tsx @@ -3,24 +3,27 @@ import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; -import Link from '../../components/atoms/links/link'; -import CardsList, { +import { + CardsList, type CardsListItem, -} from '../../components/organisms/layout/cards-list'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout from '../../components/templates/page/page-layout'; + getLayout, + Link, + PageLayout, +} from '../../components'; import PageContent, { meta } from '../../content/pages/projects.mdx'; import styles from '../../styles/pages/projects.module.scss'; -import { type NextPageWithLayout, type ProjectCard } from '../../types/app'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; -import { getProjectsCard } from '../../utils/helpers/projects'; +import { type NextPageWithLayout, type ProjectCard } from '../../types'; import { getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import useSettings from '../../utils/hooks/use-settings'; +} from '../../utils/helpers/'; +import { + getProjectsCard, + loadTranslation, + type Messages, +} from '../../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../../utils/hooks'; type ProjectsPageProps = { projects: ProjectCard[]; diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx index fbea3cc..26cfd91 100644 --- a/src/pages/recherche/index.tsx +++ b/src/pages/recherche/index.tsx @@ -3,42 +3,43 @@ import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; import { useIntl } from 'react-intl'; -import Notice from '../../components/atoms/layout/notice'; -import Spinner from '../../components/atoms/loaders/spinner'; -import PostsList from '../../components/organisms/layout/posts-list'; -import LinksListWidget from '../../components/organisms/widgets/links-list-widget'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout from '../../components/templates/page/page-layout'; -import { getArticles, getTotalArticles } from '../../services/graphql/articles'; import { - getThematicsPreview, - getTotalThematics, -} from '../../services/graphql/thematics'; + getLayout, + LinksListWidget, + Notice, + PageLayout, + PostsList, + Spinner, +} from '../../components'; import { + getArticles, + getThematicsPreview, getTopicsPreview, + getTotalArticles, + getTotalThematics, getTotalTopics, -} from '../../services/graphql/topics'; -import { type NextPageWithLayout } from '../../types/app'; +} from '../../services/graphql'; import { + type NextPageWithLayout, type RawArticle, type RawThematicPreview, type RawTopicPreview, -} from '../../types/raw-data'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; +} from '../../types'; import { + getBlogSchema, getLinksListItems, getPageLinkFromRawData, getPostsList, -} from '../../utils/helpers/pages'; -import { - getBlogSchema, getSchemaJson, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import useDataFromAPI from '../../utils/hooks/use-data-from-api'; -import usePagination from '../../utils/hooks/use-pagination'; -import useSettings from '../../utils/hooks/use-settings'; +} from '../../utils/helpers'; +import { loadTranslation, type Messages } from '../../utils/helpers/server'; +import { + useBreadcrumb, + useDataFromAPI, + usePagination, + useSettings, +} from '../../utils/hooks'; type SearchPageProps = { thematicsList: RawThematicPreview[]; diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx index ffde92d..6308978 100644 --- a/src/pages/sujet/[slug].tsx +++ b/src/pages/sujet/[slug].tsx @@ -4,39 +4,37 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { useIntl } from 'react-intl'; -import Heading from '../../components/atoms/headings/heading'; -import ResponsiveImage from '../../components/molecules/images/responsive-image'; -import PostsList from '../../components/organisms/layout/posts-list'; -import LinksListWidget from '../../components/organisms/widgets/links-list-widget'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout, { +import { + getLayout, + Heading, + LinksListWidget, + PageLayout, type PageLayoutProps, -} from '../../components/templates/page/page-layout'; + PostsList, + ResponsiveImage, +} from '../../components'; import { getAllTopicsSlugs, getTopicBySlug, getTopicsPreview, getTotalTopics, -} from '../../services/graphql/topics'; +} from '../../services/graphql'; import styles from '../../styles/pages/topic.module.scss'; import { type NextPageWithLayout, type PageLink, type Topic, -} from '../../types/app'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; +} from '../../types'; import { getLinksListItems, getPageLinkFromRawData, getPostsWithUrl, -} from '../../utils/helpers/pages'; -import { getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import useSettings from '../../utils/hooks/use-settings'; +} from '../../utils/helpers'; +import { loadTranslation, type Messages } from '../../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../../utils/hooks'; export type TopicPageProps = { currentTopic: Topic; diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx index b7d97a3..7712fff 100644 --- a/src/pages/thematique/[slug].tsx +++ b/src/pages/thematique/[slug].tsx @@ -4,37 +4,35 @@ import { useRouter } from 'next/router'; import Script from 'next/script'; import { ParsedUrlQuery } from 'querystring'; import { useIntl } from 'react-intl'; -import Heading from '../../components/atoms/headings/heading'; -import PostsList from '../../components/organisms/layout/posts-list'; -import LinksListWidget from '../../components/organisms/widgets/links-list-widget'; -import { getLayout } from '../../components/templates/layout/layout'; -import PageLayout, { +import { + getLayout, + Heading, + LinksListWidget, + PageLayout, type PageLayoutProps, -} from '../../components/templates/page/page-layout'; + PostsList, +} from '../../components'; import { getAllThematicsSlugs, getThematicBySlug, getThematicsPreview, getTotalThematics, -} from '../../services/graphql/thematics'; +} from '../../services/graphql'; import { type NextPageWithLayout, type PageLink, type Thematic, -} from '../../types/app'; -import { loadTranslation, type Messages } from '../../utils/helpers/i18n'; +} from '../../types'; import { getLinksListItems, getPageLinkFromRawData, getPostsWithUrl, -} from '../../utils/helpers/pages'; -import { getSchemaJson, getSinglePageSchema, getWebPageSchema, -} from '../../utils/helpers/schema-org'; -import useBreadcrumb from '../../utils/hooks/use-breadcrumb'; -import useSettings from '../../utils/hooks/use-settings'; +} from '../../utils/helpers'; +import { loadTranslation, type Messages } from '../../utils/helpers/server'; +import { useBreadcrumb, useSettings } from '../../utils/hooks'; export type ThematicPageProps = { currentThematic: Thematic; |
