diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-16 12:46:38 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-16 12:46:38 +0200 |
| commit | 2155550fa36a3bc3c8f66e0926530123b4018cd4 (patch) | |
| tree | 1b7472d7ceeb9c95b2c6de6440b48b94405e155e /src/pages/contact.tsx | |
| parent | 8a55aa83bd4b64d1d989cb49b7d9c3fdc1cc6ea5 (diff) | |
refactor: use custom hook for breadcrumb items and schema
Diffstat (limited to 'src/pages/contact.tsx')
| -rw-r--r-- | src/pages/contact.tsx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/pages/contact.tsx b/src/pages/contact.tsx index fcfbe1d..617117b 100644 --- a/src/pages/contact.tsx +++ b/src/pages/contact.tsx @@ -1,7 +1,6 @@ -import Notice, { NoticeKind } from '@components/atoms/layout/notice'; -import { BreadcrumbItem } from '@components/molecules/nav/breadcrumb'; +import Notice, { type NoticeKind } from '@components/atoms/layout/notice'; import ContactForm, { - ContactFormProps, + type ContactFormProps, } from '@components/organisms/forms/contact-form'; import SocialMedia from '@components/organisms/widgets/social-media'; import PageLayout from '@components/templates/page/page-layout'; @@ -17,19 +16,15 @@ import Script from 'next/script'; import { useState } from 'react'; import { useIntl } from 'react-intl'; import { ContactPage as ContactPageSchema, Graph, WebPage } from 'schema-dts'; +import useBreadcrumb from '@utils/hooks/use-breadcrumb'; const ContactPage: NextPage = () => { const { dates, intro, seo, title } = meta; const intl = useIntl(); - const homeLabel = intl.formatMessage({ - defaultMessage: 'Home', - description: 'Breadcrumb: home label', - id: 'j5k9Fe', + const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ + title, + url: `/contact`, }); - const breadcrumb: BreadcrumbItem[] = [ - { id: 'home', name: homeLabel, url: '/' }, - { id: 'contact', name: title, url: '/contact' }, - ]; const socialMediaTitle = intl.formatMessage({ defaultMessage: 'Find me elsewhere', @@ -148,9 +143,10 @@ const ContactPage: NextPage = () => { dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} /> <PageLayout - title="Contact" + breadcrumb={breadcrumbItems} + breadcrumbSchema={breadcrumbSchema} intro={intro} - breadcrumb={breadcrumb} + title="Contact" widgets={widgets} > <ContactForm |
