From 8c885444b7bb679dbe74446f387f9ece679d51b4 Mon Sep 17 00:00:00 2001 From: Thijs Daniels Date: Wed, 28 Feb 2024 15:08:38 +0100 Subject: [PATCH] fix(react-notifications): make children and onDismiss optional --- .changeset/quiet-sloths-change.md | 5 +++++ .../react-notifications/NotificationsProvider.stories.tsx | 2 +- .../react-notifications/providers/NotificationsContext.tsx | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/quiet-sloths-change.md diff --git a/.changeset/quiet-sloths-change.md b/.changeset/quiet-sloths-change.md new file mode 100644 index 00000000..1fa39c30 --- /dev/null +++ b/.changeset/quiet-sloths-change.md @@ -0,0 +1,5 @@ +--- +"@codedazur/react-notifications": patch +--- + +The children and onDismiss props are now optional. diff --git a/apps/storybook/stories/react-notifications/NotificationsProvider.stories.tsx b/apps/storybook/stories/react-notifications/NotificationsProvider.stories.tsx index e4b02fe1..74710c99 100644 --- a/apps/storybook/stories/react-notifications/NotificationsProvider.stories.tsx +++ b/apps/storybook/stories/react-notifications/NotificationsProvider.stories.tsx @@ -180,7 +180,7 @@ const Notification: FunctionComponent = ({ {children} - + {onDismiss && } {timer && } diff --git a/packages/react-notifications/providers/NotificationsContext.tsx b/packages/react-notifications/providers/NotificationsContext.tsx index d7379e4e..db1966e5 100644 --- a/packages/react-notifications/providers/NotificationsContext.tsx +++ b/packages/react-notifications/providers/NotificationsContext.tsx @@ -2,9 +2,9 @@ import { Timer } from "@codedazur/essentials"; import { ReactNode, createContext } from "react"; export interface NotificationProps { - readonly onDismiss: () => void; + readonly onDismiss?: () => void; readonly timer?: Timer; - readonly children: ReactNode; + readonly children?: ReactNode; } export type NotificationGroup = Array<{