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
11 changes: 2 additions & 9 deletions src/components/basics/Toast/ToastContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';

import { useModalStore } from '@/stores/modalStore';
import { useToastStore } from '@/stores/toastStore';
import clsx from 'clsx';
import React, { useEffect, useState } from 'react';
Expand All @@ -10,7 +9,6 @@ import Toast from './Toast';

const ToastContainer = () => {
const { toasts, hideToast } = useToastStore();
const modalType = useModalStore(state => state.type);
const [portalElement, setPortalElement] = useState<HTMLElement | null>(null);

useEffect(() => {
Expand All @@ -28,18 +26,13 @@ const ToastContainer = () => {

if (!portalElement || toasts.length === 0) return null;

const isModalOpen = modalType !== null;
const hasModalPlacementToast = toasts.some(toast => toast.placement === 'modal-bottom');
const useModalLayout = isModalOpen || hasModalPlacementToast;

return createPortal(
<div
className={clsx(
'pointer-events-none fixed inset-0 z-[60] flex flex-col gap-3 px-4',
useModalLayout ? 'items-center justify-end pb-[7.5rem]' : 'items-end pt-6'
'pointer-events-none fixed inset-0 z-60 flex flex-col items-center justify-end gap-3 px-4 pb-30'
)}
>
<div className={clsx('flex flex-col gap-3', useModalLayout ? 'items-center' : 'items-end')}>
<div className="flex flex-col items-center gap-3">
{toasts.map(toast => (
<Toast key={toast.id} {...toast} onClose={hideToast} />
))}
Expand Down