chore: allow click-to-dismiss on toasts with actions
This commit is contained in:
@@ -84,7 +84,7 @@ export const Toast = forwardRef(({ toast, index }: Props, ref: ForwardedRef<HTML
|
|||||||
animationDelay: !toast.dismissed ? '50ms' : undefined,
|
animationDelay: !toast.dismissed ? '50ms' : undefined,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!hasActions && toast.type !== ToastType.Loading && toast.type !== ToastType.Progress) {
|
if (toast.type !== ToastType.Loading && toast.type !== ToastType.Progress) {
|
||||||
dismissToast(toast.id)
|
dismissToast(toast.id)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@@ -104,7 +104,9 @@ export const Toast = forwardRef(({ toast, index }: Props, ref: ForwardedRef<HTML
|
|||||||
className={`hover:bg-passive-3 cursor-pointer rounded border-0 px-[0.45rem] py-1 text-sm font-semibold md:bg-transparent ${colorForToastType(
|
className={`hover:bg-passive-3 cursor-pointer rounded border-0 px-[0.45rem] py-1 text-sm font-semibold md:bg-transparent ${colorForToastType(
|
||||||
toast.type,
|
toast.type,
|
||||||
)} ${index !== 0 ? 'ml-2' : ''}`}
|
)} ${index !== 0 ? 'ml-2' : ''}`}
|
||||||
onClick={() => {
|
onClick={(event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
action.handler(toast.id)
|
action.handler(toast.id)
|
||||||
}}
|
}}
|
||||||
key={index}
|
key={index}
|
||||||
|
|||||||
Reference in New Issue
Block a user