Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/toaster/src/ToastManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const hasCustomId = settings => Object.hasOwnProperty.call(settings, 'id')

const ToastManager = memo(function ToastManager(props) {
const { bindCloseAll, bindGetToasts, bindNotify, bindRemove } = props

const [zindex, setZindex] = useState(100)
const [toasts, setToasts] = useState([])
const [idCounter, setIdCounter] = useState(0)

Expand Down Expand Up @@ -63,11 +63,19 @@ const ToastManager = memo(function ToastManager(props) {
hasCloseButton: settings.hasCloseButton ?? true,
duration: settings.duration || 5,
close: () => safeCloseToast(id),
intent: settings.intent
intent: settings.intent,
zIndex: settings.zIndex
}
}

const notify = (title, settings) => {
setZindex(settings.zIndex)
if (settings.zIndex != undefined) {
setZindex(settings.zIndex)
} else {
setZindex(100)
}

let tempToasts = toasts
if (hasCustomId(settings)) {
tempToasts = removeToast(settings.id)
Expand All @@ -92,7 +100,7 @@ const ToastManager = memo(function ToastManager(props) {
left={0}
right={0}
position="fixed"
zIndex={StackingOrder.TOASTER}
zIndex={zindex}
pointerEvents="none"
>
{toasts.map(({ description, id, ...rest }) => {
Expand Down