import classNames from 'classnames' import { Toast as BS5Toast } from 'react-bootstrap-5' import { NotificationIcon, NotificationType, } from '../../../../shared/components/notification' import { useTranslation } from 'react-i18next' import MaterialIcon from '../../../../shared/components/material-icon' import { ReactNode, useCallback, useState } from 'react' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import { Toast as BS3Toast } from '../bootstrap-3/toast' export type OLToastProps = { type: NotificationType className?: string title?: string content: string | ReactNode isDismissible?: boolean onDismiss?: () => void autoHide?: boolean delay?: number } export const OLToast = ({ type = 'info', className = '', content, title, isDismissible, onDismiss, autoHide, delay, }: OLToastProps) => { const { t } = useTranslation() const [show, setShow] = useState(true) const toastClassName = classNames( 'notification', `notification-type-${type}`, className, 'toast-content' ) const handleClose = useCallback(() => { setShow(false) }, []) const handleOnHidden = useCallback(() => { if (onDismiss) onDismiss() }, [onDismiss]) const toastElement = (
{title}
)} {content}