Skip to content

Commit

Permalink
fix(react-notifications): make children and onDismiss optional
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsdaniels committed Feb 28, 2024
1 parent bc4e3ad commit 8c88544
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-sloths-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codedazur/react-notifications": patch
---

The children and onDismiss props are now optional.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const Notification: FunctionComponent<NotificationProps> = ({
<EdgeInset all="0.5rem" left="1rem">
<Row justify="space-between" align="center" gap="1rem">
{children}
<Button onClick={onDismiss}>Dismiss</Button>
{onDismiss && <Button onClick={onDismiss}>Dismiss</Button>}
</Row>
</EdgeInset>
{timer && <NotificationProgress timer={timer} />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand Down

0 comments on commit 8c88544

Please sign in to comment.