Skip to content

Commit

Permalink
types: change label types to ReactNode (#280)
Browse files Browse the repository at this point in the history
* types: change label types to ReactNode

* types: add `event` to cancel.onClick

* feat: pass `event` to cancel.onClick

* fix: missing `event` argument
  • Loading branch information
CanRau authored Dec 31, 2023
1 parent abe2ceb commit 6a94603
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@ const Toast = (props: ToastProps) => {
data-button
data-cancel
style={toast.cancelButtonStyle || cancelButtonStyle}
onClick={() => {
onClick={(event) => {
if (!dismissible) return;
deleteToast();
if (toast.cancel?.onClick) {
toast.cancel.onClick();
toast.cancel.onClick(event);
}
}}
className={cn(classNames?.cancelButton, toast?.classNames?.cancelButton)}
Expand Down
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ export interface ToastT {
delete?: boolean;
important?: boolean;
action?: {
label: string;
label: React.ReactNode;
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
};
cancel?: {
label: string;
onClick?: () => void;
label: React.ReactNode;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
};
onDismiss?: (toast: ToastT) => void;
onAutoClose?: (toast: ToastT) => void;
Expand Down

1 comment on commit 6a94603

@vercel
Copy link

@vercel vercel bot commented on 6a94603 Dec 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.