'use client'; import type { CreateToasterReturn } from '@chakra-ui/react'; import { Toaster as ChakraToaster, Portal, Spinner, Stack, Toast, createToaster, } from '@chakra-ui/react'; import { SECOND } from '../utils/consts'; import { CloseButton } from './close-button'; export const toaster: CreateToasterReturn = createToaster({ placement: 'top-end', pauseOnPageIdle: true, duration: 10 * SECOND, offsets: { top: '12px', right: '12px', bottom: '12px', left: '12px', }, }); export const Toaster = () => { return ( { (toast) => { const closable = toast.meta?.closable !== undefined ? toast.meta.closable : true; return ( { toast.type === 'loading' ? ( ) : null } { toast.title && { toast.title } } { (toast.meta?.renderDescription || toast.description) && ( { toast.meta?.renderDescription?.() || toast.description } ) } { toast.action && ( { toast.action.label } ) } { closable && ( ) } ); } } ); };