aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-15 12:24:42 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-15 17:26:16 +0100
commit0f38aee374029213a47ef7c29bd164093fe63c85 (patch)
tree290cb6471fdfe81e4c42f4da4729247536b04ee7 /src/components/atoms
parentbe4d907efb4e2fa658baa7c9b276ed282eb920db (diff)
refactor(hooks): remove useSettings hook
It does not make sense to re-export an existing object through a hook. On some pages both the hook and the object was imported... It is better to use the CONFIG (previously settings) object directly and by doing it we avoid potential errors because of conditional hooks.
Diffstat (limited to 'src/components/atoms')
-rw-r--r--src/components/atoms/layout/time/time.test.tsx4
-rw-r--r--src/components/atoms/layout/time/time.tsx6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/components/atoms/layout/time/time.test.tsx b/src/components/atoms/layout/time/time.test.tsx
index 910285d..f3da8b5 100644
--- a/src/components/atoms/layout/time/time.test.tsx
+++ b/src/components/atoms/layout/time/time.test.tsx
@@ -1,6 +1,6 @@
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '../../../../../tests/utils';
-import { settings } from '../../../../utils/config';
+import { CONFIG } from '../../../../utils/config';
import { Time } from './time';
describe('Time', () => {
@@ -31,7 +31,7 @@ describe('Time', () => {
expect(
rtlScreen.getByText(new RegExp(`${date.getFullYear()}`))
).toHaveTextContent(
- new Intl.DateTimeFormat(settings.locales.defaultLocale, {
+ new Intl.DateTimeFormat(CONFIG.locales.defaultLocale, {
weekday: 'long',
}).format(date)
);
diff --git a/src/components/atoms/layout/time/time.tsx b/src/components/atoms/layout/time/time.tsx
index 02b4763..886fee0 100644
--- a/src/components/atoms/layout/time/time.tsx
+++ b/src/components/atoms/layout/time/time.tsx
@@ -4,7 +4,7 @@ import {
forwardRef,
} from 'react';
import { useIntl } from 'react-intl';
-import { settings } from '../../../../utils/config';
+import { CONFIG } from '../../../../utils/config';
type GetDateOptionsConfig = {
hasDay: boolean;
@@ -65,7 +65,7 @@ export type TimeProps = Omit<
/**
* The current locale.
*
- * @default settings.locales.defaultLocale
+ * @default CONFIG.locales.defaultLocale
*/
locale?: string;
/**
@@ -88,7 +88,7 @@ const TimeWithRef: ForwardRefRenderFunction<HTMLTimeElement, TimeProps> = (
hideDay = false,
hideMonth = false,
hideYear = false,
- locale = settings.locales.defaultLocale,
+ locale = CONFIG.locales.defaultLocale,
showTime = false,
showWeekDay = false,
...props