import { useContext, useCallback, ReactNode, CSSProperties } from 'react';
import cx from 'classnames';
import { Icon } from '../icon';
import uniqueId from '../utils/uniqueId';
import { NoticePositions, getContainer, remove } from './Container';
import { NoticeContext } from './Wrap';
import { isElement } from 'react-is';
export interface INoticeProps {
title: string;
className?: string;
style?: CSSProperties;
type?: 'info' | 'success' | 'warning' | 'error';
closable?: boolean;
onClose?: () => void;
autoClose?: boolean;
timeout?: number;
children?: ReactNode;
position?: NoticePositions;
}
function renderIcon(
type: 'info' | 'success' | 'warning' | 'error' | undefined
) {
switch (type) {
case 'info':
return (