Skip to content

Commit ceb11c2

Browse files
committed
do not display the toaster component if there are no toast items
1 parent 9bace29 commit ceb11c2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/keybr-widget/lib/components/toast/Toaster.module.less

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
margin-inline: auto auto;
1212
margin-block: auto 0;
1313
padding: 3rem;
14-
pointer-events: none;
1514
}
1615

17-
.toaster > * {
18-
pointer-events: auto;
16+
.toaster[hidden] {
17+
display: none;
1918
}

packages/keybr-widget/lib/components/toast/Toaster.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function Toaster(): ReactNode {
88
const [toasts, setToasts] = useState(state.toasts);
99
useEffect(() => state.listen(setToasts), [toasts]);
1010
return (
11-
<div className={styles.toaster}>
11+
<div className={styles.toaster} hidden={toasts.length === 0}>
1212
{[...toasts].reverse().map((toast) => (
1313
<ToastProvider key={toast.key} toast={toast}>
1414
<ToastWrapper>{toast.message}</ToastWrapper>

0 commit comments

Comments
 (0)