diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-29 18:21:37 +0100 | 
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-29 19:02:57 +0100 | 
| commit | e4d5b8151802517b2943756fc0d09ffa95e2c4e2 (patch) | |
| tree | 9e99137a7b64ea7993a8311a7162336a551be8b2 /src/components/PostsList | |
| parent | 47b854de26dea24e7838fd0804df103dee99635f (diff) | |
chore: replace lingui functions with react-intl
Diffstat (limited to 'src/components/PostsList')
| -rw-r--r-- | src/components/PostsList/PostsList.tsx | 25 | 
1 files changed, 19 insertions, 6 deletions
| 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}> | 
