import React from 'react'; import classNames from 'classnames'; import { SessionIcon, SessionIconButton, SessionIconSize, SessionIconType, } from './icon/'; export enum SessionToastType { Info = 'info', Success = 'success', Warning = 'warning', Error = 'error', } interface Props { title: string; id?: string; type?: SessionToastType; icon?: SessionIconType; description?: string; closeToast: any; } export class SessionToast extends React.PureComponent { constructor(props: any) { super(props); } public render() { const { title, description, type, icon } = this.props; const toastType = type ? type : SessionToastType.Info; const toastDesc = description ? description : ''; const toastIconSize = toastDesc ? SessionIconSize.Huge : SessionIconSize.Medium; // Set a custom icon or allow the theme to define the icon let toastIcon = icon || undefined; if (!toastIcon) { switch (type) { case SessionToastType.Info: toastIcon = SessionIconType.Info; break; case SessionToastType.Success: toastIcon = SessionIconType.Check; break; case SessionToastType.Error: toastIcon = SessionIconType.Error; break; case SessionToastType.Warning: toastIcon = SessionIconType.Warning; break; default: toastIcon = SessionIconType.Info; } } return (

{title}

{toastDesc}

); } }