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/Settings/ReduceMotion/ReduceMotion.tsx | 18 ++++++++++++++---- src/components/Settings/Settings.tsx | 10 ++++++++-- src/components/Settings/ThemeToggle/ThemeToggle.tsx | 8 ++++++-- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src/components/Settings') diff --git a/src/components/Settings/ReduceMotion/ReduceMotion.tsx b/src/components/Settings/ReduceMotion/ReduceMotion.tsx index 01f8b67..c7b5775 100644 --- a/src/components/Settings/ReduceMotion/ReduceMotion.tsx +++ b/src/components/Settings/ReduceMotion/ReduceMotion.tsx @@ -1,9 +1,10 @@ import { Toggle } from '@components/Form'; -import { t } from '@lingui/macro'; import { LocalStorage } from '@services/local-storage'; import { useEffect, useState } from 'react'; +import { useIntl } from 'react-intl'; const ReduceMotion = () => { + const intl = useIntl(); const [isDeactivated, setIsDeactivated] = useState(false); useEffect(() => { @@ -23,9 +24,18 @@ const ReduceMotion = () => { return ( diff --git a/src/components/Settings/Settings.tsx b/src/components/Settings/Settings.tsx index bd2f33d..80eb0c3 100644 --- a/src/components/Settings/Settings.tsx +++ b/src/components/Settings/Settings.tsx @@ -1,14 +1,20 @@ import { CogIcon } from '@components/Icons'; import ThemeToggle from '@components/Settings/ThemeToggle/ThemeToggle'; -import { t } from '@lingui/macro'; +import { useIntl } from 'react-intl'; import ReduceMotion from './ReduceMotion/ReduceMotion'; import styles from './Settings.module.scss'; const Settings = () => { + const intl = useIntl(); + return ( <>
- {t`Settings`} + {' '} + {intl.formatMessage({ + defaultMessage: 'Settings', + description: 'Settings: modal title', + })}
diff --git a/src/components/Settings/ThemeToggle/ThemeToggle.tsx b/src/components/Settings/ThemeToggle/ThemeToggle.tsx index e14f39a..5b7a34d 100644 --- a/src/components/Settings/ThemeToggle/ThemeToggle.tsx +++ b/src/components/Settings/ThemeToggle/ThemeToggle.tsx @@ -1,11 +1,12 @@ import { Toggle } from '@components/Form'; import { MoonIcon, SunIcon } from '@components/Icons'; import Spinner from '@components/Spinner/Spinner'; -import { t } from '@lingui/macro'; import { useTheme } from 'next-themes'; import { useEffect, useState } from 'react'; +import { useIntl } from 'react-intl'; const ThemeToggle = () => { + const intl = useIntl(); const [isMounted, setIsMounted] = useState(false); const { resolvedTheme, setTheme } = useTheme(); @@ -24,7 +25,10 @@ const ThemeToggle = () => { return ( } rightChoice={} value={isDarkTheme} -- cgit v1.2.3