From e4d5b8151802517b2943756fc0d09ffa95e2c4e2 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sat, 29 Jan 2022 18:21:37 +0100 Subject: chore: replace lingui functions with react-intl --- src/components/Widgets/CVPreview/CVPreview.tsx | 16 ++++++--- src/components/Widgets/RecentPosts/RecentPosts.tsx | 16 +++++++-- .../Widgets/RelatedThematics/RelatedThematics.tsx | 12 +++++-- .../Widgets/RelatedTopics/RelatedTopics.tsx | 12 +++++-- src/components/Widgets/Sharing/Sharing.tsx | 42 ++++++++++++++++++---- .../Widgets/ThematicsList/ThematicsList.tsx | 13 +++++-- src/components/Widgets/ToC/ToC.tsx | 8 +++-- src/components/Widgets/TopicsList/TopicsList.tsx | 13 +++++-- 8 files changed, 109 insertions(+), 23 deletions(-) (limited to 'src/components/Widgets') diff --git a/src/components/Widgets/CVPreview/CVPreview.tsx b/src/components/Widgets/CVPreview/CVPreview.tsx index e52a9b2..08a4c72 100644 --- a/src/components/Widgets/CVPreview/CVPreview.tsx +++ b/src/components/Widgets/CVPreview/CVPreview.tsx @@ -1,7 +1,7 @@ import { ExpandableWidget } from '@components/WidgetParts'; -import { Trans } from '@lingui/macro'; import Image from 'next/image'; import Link from 'next/link'; +import { FormattedMessage } from 'react-intl'; import styles from './CVPreview.module.scss'; const CVPreview = ({ @@ -25,9 +25,17 @@ const CVPreview = ({ />

- - Download CV in PDF - + ( + + {chunks} + + ), + }} + />

); diff --git a/src/components/Widgets/RecentPosts/RecentPosts.tsx b/src/components/Widgets/RecentPosts/RecentPosts.tsx index 8022bff..08ce7e4 100644 --- a/src/components/Widgets/RecentPosts/RecentPosts.tsx +++ b/src/components/Widgets/RecentPosts/RecentPosts.tsx @@ -1,16 +1,17 @@ import Spinner from '@components/Spinner/Spinner'; import { config } from '@config/website'; -import { t } from '@lingui/macro'; import { getPublishedPosts } from '@services/graphql/queries'; import { ArticlePreview } from '@ts/types/articles'; import { getFormattedDate } from '@utils/helpers/format'; import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/router'; +import { useIntl } from 'react-intl'; import useSWR from 'swr'; import styles from './RecentPosts.module.scss'; const RecentPosts = () => { + const intl = useIntl(); const { data, error } = useSWR('/recent-posts', () => getPublishedPosts({ first: 3 }) ); @@ -36,7 +37,12 @@ const RecentPosts = () => { )}

{post.title}

-
{t`Published on:`}
+
+ {intl.formatMessage({ + defaultMessage: 'Published on:', + description: 'RecentPosts: publication date label', + })} +