From 93085000a7b8ab8b66357c21ee4bec29adde58e2 Mon Sep 17 00:00:00 2001 From: Thijs Daniels Date: Wed, 27 Mar 2024 13:32:40 +0100 Subject: [PATCH] refactor(react-notifications): separate context from provider --- .../{providers => components}/NotificationsProvider.tsx | 2 +- .../notificationsContext.ts} | 0 packages/react-notifications/hooks/useNotifications.ts | 2 +- packages/react-notifications/index.ts | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/react-notifications/{providers => components}/NotificationsProvider.tsx (99%) rename packages/react-notifications/{providers/NotificationsContext.tsx => contexts/notificationsContext.ts} (100%) diff --git a/packages/react-notifications/providers/NotificationsProvider.tsx b/packages/react-notifications/components/NotificationsProvider.tsx similarity index 99% rename from packages/react-notifications/providers/NotificationsProvider.tsx rename to packages/react-notifications/components/NotificationsProvider.tsx index c17a2bb9..74e5837e 100644 --- a/packages/react-notifications/providers/NotificationsProvider.tsx +++ b/packages/react-notifications/components/NotificationsProvider.tsx @@ -14,7 +14,7 @@ import { NotificationProps, Notifications, notificationsContext, -} from "./NotificationsContext"; +} from "../contexts/notificationsContext"; interface AddAction { operation: "add"; diff --git a/packages/react-notifications/providers/NotificationsContext.tsx b/packages/react-notifications/contexts/notificationsContext.ts similarity index 100% rename from packages/react-notifications/providers/NotificationsContext.tsx rename to packages/react-notifications/contexts/notificationsContext.ts diff --git a/packages/react-notifications/hooks/useNotifications.ts b/packages/react-notifications/hooks/useNotifications.ts index dcb10135..cab6fc8e 100644 --- a/packages/react-notifications/hooks/useNotifications.ts +++ b/packages/react-notifications/hooks/useNotifications.ts @@ -1,5 +1,5 @@ import { ReactNode, useContext } from "react"; -import { notificationsContext } from "../providers/NotificationsContext"; +import { notificationsContext } from "../contexts/notificationsContext"; /** * @param {string} [group="default"] - The notification group to associate with. diff --git a/packages/react-notifications/index.ts b/packages/react-notifications/index.ts index b8e90a9f..1ea6ff74 100644 --- a/packages/react-notifications/index.ts +++ b/packages/react-notifications/index.ts @@ -1,3 +1,3 @@ +export * from "./components/NotificationsProvider"; +export * from "./contexts/notificationsContext"; export * from "./hooks/useNotifications"; -export * from "./providers/NotificationsProvider"; -export * from "./providers/NotificationsContext";