aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-29 19:03:59 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-29 19:03:59 +0100
commit8fb5e4ef3ae925ebc6622711fb5c8c6147642cbc (patch)
tree9e99137a7b64ea7993a8311a7162336a551be8b2 /src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx
parent2bae7c43764df5678fe2fc2e68be11ae95d85a41 (diff)
parente4d5b8151802517b2943756fc0d09ffa95e2c4e2 (diff)
feat(i18n): replace linguijs with formatjs
Diffstat (limited to 'src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx')
-rw-r--r--src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx b/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx
index 246ad80..e9f6079 100644
--- a/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx
+++ b/src/components/Buttons/ButtonToolbar/ButtonToolbar.tsx
@@ -1,6 +1,6 @@
import { CloseIcon, CogIcon, SearchIcon } from '@components/Icons';
-import { t } from '@lingui/macro';
import { ForwardedRef, forwardRef, SetStateAction } from 'react';
+import { useIntl } from 'react-intl';
import styles from '../Buttons.module.scss';
type ButtonType = 'search' | 'settings';
@@ -17,6 +17,7 @@ const ButtonToolbar = (
},
ref: ForwardedRef<HTMLButtonElement>
) => {
+ const intl = useIntl();
const ButtonIcon = () => (type === 'search' ? <SearchIcon /> : <CogIcon />);
const btnClasses = isActivated
? `${styles.toolbar} ${styles['toolbar--activated']}`
@@ -38,9 +39,29 @@ const ButtonToolbar = (
</span>
</span>
{isActivated ? (
- <span className="screen-reader-text">{t`Close ${type}`}</span>
+ <span className="screen-reader-text">
+ {intl.formatMessage(
+ {
+ defaultMessage: 'Close {type}',
+ description: 'ButtonToolbar: Close button',
+ },
+ {
+ type,
+ }
+ )}
+ </span>
) : (
- <span className="screen-reader-text">{t`Open ${type}`}</span>
+ <span className="screen-reader-text">
+ {intl.formatMessage(
+ {
+ defaultMessage: 'Open {type}',
+ description: 'ButtonToolbar: Open button',
+ },
+ {
+ type,
+ }
+ )}
+ </span>
)}
</button>
);