import Notification from '../base/notification'; const prefixCls = 'ivu-notice'; const iconPrefixCls = 'ivu-icon'; const prefixKey = 'ivu_notice_key_'; let top = 24; let defaultDuration = 4.5; let noticeInstance; let name = 1; const iconTypes = { 'info': 'information-circled', 'success': 'checkmark-circled', 'warning': 'android-alert', 'error': 'close-circled' }; function getNoticeInstance () { noticeInstance = noticeInstance || Notification.newInstance({ prefixCls: prefixCls, styles: { top: `${top}px`, right: 0 } }); return noticeInstance; } function notice (type, options) { const title = options.title || ''; const desc = options.desc || ''; const noticeKey = options.name || `${prefixKey}${name}`; const onClose = options.onClose || function () {}; const render = options.render; // todo const btn = options.btn || null; const duration = (options.duration === 0) ? 0 : options.duration || defaultDuration; name++; let instance = getNoticeInstance(); let content; let withIcon; const with_desc = (options.render && !title) ? '' : (desc || options.render) ? ` ${prefixCls}-with-desc` : ''; if (type == 'normal') { withIcon = false; content = `