Browse Source

chore: 迁移 notification iconfont

pull/361/head
elrrrrrrr 9 years ago
parent
commit
ac6505e68a
  1. 15
      components/notification/index.jsx

15
components/notification/index.jsx

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import Notification from 'rc-notification'; import Notification from 'rc-notification';
import assign from 'object-assign'; import assign from 'object-assign';
import Icon from '../iconfont';
let top = 24; let top = 24;
let notificationInstance; let notificationInstance;
@ -29,27 +30,27 @@ function notice(args) {
if (args.icon) { if (args.icon) {
let prefixCls = ' ant-notification-notice-content-icon-'; let prefixCls = ' ant-notification-notice-content-icon-';
let iconClass = 'anticon anticon-'; let iconType = '';
switch (args.icon) { switch (args.icon) {
case 'success': case 'success':
iconClass += 'check-circle-o'; iconType = 'check-circle-o';
break; break;
case 'info': case 'info':
iconClass += 'info-circle-o'; iconType = 'info-circle-o';
break; break;
case 'error': case 'error':
iconClass += 'exclamation-circle-o'; iconType = 'exclamation-circle-o';
break; break;
case 'warn': case 'warn':
iconClass += 'question-circle-o'; iconType = 'question-circle-o';
break; break;
default: default:
iconClass += 'info-circle'; iconType = 'info-circle';
} }
getNotificationInstance().notice({ getNotificationInstance().notice({
content: <div> content: <div>
<i className={iconClass + prefixCls + 'icon-' + args.icon + prefixCls + 'icon'}></i> <Icon className={prefixCls + 'icon-' + args.icon + prefixCls + 'icon'} type={iconType} />
<p className={prefixCls + 'message'}>{args.message}</p> <p className={prefixCls + 'message'}>{args.message}</p>

Loading…
Cancel
Save