ant-design/components/message/index.jsx

67 lines
1.6 KiB
React
Raw Normal View History

'use strict';
//import React from 'react';
import Notification from 'rc-notification';
2015-07-11 18:00:58 +08:00
var defaultDuration = 2.5;
var getMessageInstance = function(){
2015-07-11 18:00:58 +08:00
return Notification.newInstance({
prefixCls: 'ant-message',
transitionName: 'move-up',
style: {
top: '16px'
}
});
};
2015-07-11 18:00:58 +08:00
export default {
info: function(m, t) {
2015-07-11 18:00:58 +08:00
var message = getMessageInstance();
t = t || defaultDuration;
message.notice({
key: 'simpleMessage',
duration: t,
style: {
left: '50%'
},
content: <div className='ant-message-custom-content'>
<i className='anticon anticon-info-circle ant-message-info'></i>
<span>{m}</span>
</div>
});
},
success: function(m, t) {
2015-07-11 18:00:58 +08:00
var message = getMessageInstance();
t = t || defaultDuration;
message.notice({
key: 'simpleMessage1',
transitionName: 'move-up',
duration: t,
style: {
left: '50%'
},
content: <div className='ant-message-custom-content'>
<i className='anticon anticon-check-circle ant-message-success'></i>
<span>{m}</span>
</div>
});
},
error: function(m, t) {
2015-07-11 18:00:58 +08:00
var message = getMessageInstance();
t = t || defaultDuration;
message.notice({
key: 'simpleMessage2',
transitionName: 'move-up',
duration: t,
style: {
left: '50%'
},
content: <div className='ant-message-custom-content'>
<i className='anticon anticon-exclamation-circle ant-message-error'></i>
<span>{m}</span>
</div>
});
}
};