From e4d5b8151802517b2943756fc0d09ffa95e2c4e2 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Sat, 29 Jan 2022 18:21:37 +0100
Subject: chore: replace lingui functions with react-intl

---
 src/components/PostsList/PostsList.tsx | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

(limited to 'src/components/PostsList/PostsList.tsx')

diff --git a/src/components/PostsList/PostsList.tsx b/src/components/PostsList/PostsList.tsx
index df9dfe4..16deee3 100644
--- a/src/components/PostsList/PostsList.tsx
+++ b/src/components/PostsList/PostsList.tsx
@@ -1,9 +1,9 @@
-import { t } from '@lingui/macro';
-import { PostsList as PostsListData } from '@ts/types/blog';
-import styles from './PostsList.module.scss';
 import PostPreview from '@components/PostPreview/PostPreview';
-import { ForwardedRef, forwardRef, Fragment } from 'react';
+import { PostsList as PostsListData } from '@ts/types/blog';
 import { sortPostsByYear } from '@utils/helpers/sort';
+import { ForwardedRef, forwardRef, Fragment } from 'react';
+import { useIntl } from 'react-intl';
+import styles from './PostsList.module.scss';
 
 const PostsList = (
   {
@@ -15,6 +15,7 @@ const PostsList = (
   },
   ref: ForwardedRef<HTMLSpanElement>
 ) => {
+  const intl = useIntl();
   const titleLevel = showYears ? 3 : 2;
 
   const getPostsListByYear = () => {
@@ -32,7 +33,12 @@ const PostsList = (
         <section key={year} className={styles.section}>
           {showYears && (
             <h2 className={styles.year}>
-              <span className="screen-reader-text">{t`Published in`} </span>
+              <span className="screen-reader-text">
+                {intl.formatMessage({
+                  defaultMessage: 'Published on',
+                  description: 'PostsList: published on year label',
+                })}{' '}
+              </span>
               {year}
             </h2>
           )}
@@ -62,7 +68,14 @@ const PostsList = (
       };
 
       if (page.posts.length === 0) {
-        return <p key="no-result">{t`No results found.`}</p>;
+        return (
+          <p key="no-result">
+            {intl.formatMessage({
+              defaultMessage: 'No results found.',
+              description: 'PostsList: no results',
+            })}
+          </p>
+        );
       } else {
         return (
           <Fragment key={page.pageInfo.endCursor}>
-- 
cgit v1.2.3

