import CheckCircleFilled from '@ant-design/icons/CheckCircleFilled'; import CloseCircleFilled from '@ant-design/icons/CloseCircleFilled'; import CloseOutlined from '@ant-design/icons/CloseOutlined'; import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; import LoadingOutlined from '@ant-design/icons/LoadingOutlined'; import classNames from 'classnames'; import { Notice } from 'rc-notification'; import type { NoticeProps } from 'rc-notification/es/Notice'; import * as React from 'react'; import type { IconType} from './protocol'; import { NOTIFICATION_PREFIX_CLS } from './protocol'; export const TypeIcon = { info: , success: , error: , warning: , loading: , }; export function getCloseIcon(prefixCls: string, closeIcon?: React.ReactNode): React.ReactNode { if (closeIcon === null || closeIcon === false) { return null; } return closeIcon || ; } export interface PureContentProps { prefixCls: string; icon?: React.ReactNode; message?: React.ReactNode; description?: React.ReactNode; btn?: React.ReactNode; type?: IconType; role?: 'alert' | 'status'; } const typeToIcon = { success: CheckCircleFilled, info: InfoCircleFilled, error: CloseCircleFilled, warning: ExclamationCircleFilled, }; export const PureContent: React.FC = (props) => { const { prefixCls, icon, type, message, description, btn, role = 'alert' } = props; let iconNode: React.ReactNode = null; if (icon) { iconNode = {icon}; } else if (type) { iconNode = React.createElement(typeToIcon[type] || null, { className: classNames(`${prefixCls}-icon`, `${prefixCls}-icon-${type}`), }); } return (
{iconNode}
{message}
{description}
{btn &&
{btn}
}
); }; export interface PurePanelProps extends Omit, Omit { prefixCls?: string; } /** @private Internal Component. Do not use in your production. */ const PurePanel: React.FC = (props) => { const { prefixCls= NOTIFICATION_PREFIX_CLS, className, icon, type, message, description, btn, closable = true, closeIcon, className: notificationClassName, ...restProps } = props; return (
} />
); }; export default PurePanel;