From 378123d893d4bcfb826cfcb6732b0cdcb7f55b82 Mon Sep 17 00:00:00 2001 From: nhanluongoe Date: Thu, 4 Jul 2024 16:00:15 +0700 Subject: [PATCH] fix: not showing icon for toast types --- src/components/toast-icon.tsx | 4 ++++ src/components/toaster.tsx | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/toast-icon.tsx b/src/components/toast-icon.tsx index 34e4c38..b6ddd3b 100644 --- a/src/components/toast-icon.tsx +++ b/src/components/toast-icon.tsx @@ -52,6 +52,10 @@ const ToastIcon: React.FC = (props) => { return null; }; + const hasIcon = renderIcon() !== null; + + if (!hasIcon) return null; + return {renderIcon()}; }; diff --git a/src/components/toaster.tsx b/src/components/toaster.tsx index 445defe..a15330a 100644 --- a/src/components/toaster.tsx +++ b/src/components/toaster.tsx @@ -60,7 +60,7 @@ export const Toaster: React.FC = (props) => { alignItems: 'center', }} > - {icon && } +
{title && {title}} {description && (