Skip to content

Commit 728e87c

Browse files
authored
Allow to hide icons by passing null (#610)
1 parent 0ae333b commit 728e87c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ const Toast = (props: ToastProps) => {
254254
return <Loader className={cn(classNames?.loader, toast?.classNames?.loader)} visible={toastType === 'loading'} />;
255255
}
256256

257+
const icon = toast.icon || icons?.[toastType] || getAsset(toastType);
258+
257259
return (
258260
<li
259261
tabIndex={0}
@@ -429,10 +431,12 @@ const Toast = (props: ToastProps) => {
429431
</button>
430432
) : null}
431433
{/* TODO: This can be cleaner */}
432-
{toastType || toast.icon || toast.promise ? (
434+
{(toastType || toast.icon || toast.promise) &&
435+
toast.icon !== null &&
436+
(icons?.[toastType] !== null || toast.icon) ? (
433437
<div data-icon="" className={cn(classNames?.icon, toast?.classNames?.icon)}>
434438
{toast.promise || (toast.type === 'loading' && !toast.icon) ? toast.icon || getLoadingIcon() : null}
435-
{toast.type !== 'loading' ? toast.icon || icons?.[toastType] || getAsset(toastType) : null}
439+
{toast.type !== 'loading' ? icon : null}
436440
</div>
437441
) : null}
438442

0 commit comments

Comments
 (0)