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/CommentsList | |
| parent | 47b854de26dea24e7838fd0804df103dee99635f (diff) | |
chore: replace lingui functions with react-intl
Diffstat (limited to 'src/components/CommentsList')
| -rw-r--r-- | src/components/CommentsList/CommentsList.tsx | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/components/CommentsList/CommentsList.tsx b/src/components/CommentsList/CommentsList.tsx index bdca00b..6630a03 100644 --- a/src/components/CommentsList/CommentsList.tsx +++ b/src/components/CommentsList/CommentsList.tsx @@ -1,6 +1,6 @@ -import { Comment as CommentData } from '@ts/types/comments'; import Comment from '@components/Comment/Comment'; -import { t } from '@lingui/macro'; +import { Comment as CommentData } from '@ts/types/comments'; +import { useIntl } from 'react-intl'; import styles from './CommentsList.module.scss'; const CommentsList = ({ @@ -10,6 +10,8 @@ const CommentsList = ({ articleId: number; comments: CommentData[]; }) => { + const intl = useIntl(); + const getCommentsList = () => { return comments.map((comment) => { return ( @@ -20,11 +22,21 @@ const CommentsList = ({ return ( <> - <h2 className={styles.title}>{t`Comments`}</h2> + <h2 className={styles.title}> + {intl.formatMessage({ + defaultMessage: 'Comments', + description: 'CommentsList: Comments section title', + })} + </h2> {comments.length > 0 ? ( <ol className={styles.list}>{getCommentsList()}</ol> ) : ( - <p className={styles['no-comments']}>{t`No comments yet.`}</p> + <p className={styles['no-comments']}> + {intl.formatMessage({ + defaultMessage: 'No comments yet.', + description: 'CommentsList: No comment message', + })} + </p> )} </> ); |
