Skip to content

Commit

Permalink
support js style export
Browse files Browse the repository at this point in the history
  • Loading branch information
yenian.ll committed Sep 6, 2018
1 parent 7feedc0 commit 4f0a173
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 0.5.11
`CHANGED` support js style export
# 0.5.10
* `FIXED` to Message.clear function error and `NEW` API Message.mask_loading
# 0.5.4
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ http://uxcore.github.io/
* Message.error(content, duration, onClose)
* Message.info(content, duration, onClose)
* Message.loading(content, duration, onClose)
* Message.nw_loading(content, duration, onClose) // 信息平台新 logo 的 loading
* Message.mask_loading(content, duration, onClose) // 带遮罩全局的 loading,防止重复点击提交,duration=0代表不会消失,必须使用Message.clear()清除
* Message.clear() // 清除所有的 message。

Expand Down
5 changes: 4 additions & 1 deletion demo/MessageDemo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ class Demo extends React.Component {
}

handleClick(type) {
Message[type](type, 300);
Message[type](type, 3);
setTimeout(() => {
Message.clear();
}, 1500);
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uxcore-message",
"version": "0.5.10",
"version": "0.5.11",
"description": "uxcore-message component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-message.git",
"author": "eternaslky",
Expand Down
14 changes: 8 additions & 6 deletions src/Message.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let multipleInstance = true;
let size = 'small';
let messageCounter = 0;

function createMessageInstance() {
function createMessageInstance(options, type) {
if (messageInstance && messageInstance.destroy) {
messageInstance.destroy();
}
Expand All @@ -22,7 +22,7 @@ function createMessageInstance() {
{
prefixCls,
className,
transitionName,
transitionName: type === 'mask_loading' ? '' : transitionName,
getContainer,
style: {
left: '50%',
Expand Down Expand Up @@ -72,7 +72,9 @@ function notice(content, duration = defaultDuration, type, onClose) {
nw_loading: 'kuma-loading',
}[type];

const instance = multipleInstance && messageInstance ? messageInstance : createMessageInstance(options);
const instance = multipleInstance && messageInstance && type !== 'mask_loading'
? messageInstance
: createMessageInstance(options, type);

incrementCounter();
let activeWrapStyle = {
Expand All @@ -85,10 +87,10 @@ function notice(content, duration = defaultDuration, type, onClose) {
width: '100vw',
position: 'fixed',
maxWidth: '100vw',
height: ' 100vh',
margin: '0',
height: '100vh',
margin: 0,
top: 0,
left: '0',
left: 0,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
Expand Down
1 change: 1 addition & 0 deletions style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '../src/Message.less';
19 changes: 19 additions & 0 deletions webpack.custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const modifyVars = require('kuma-base/jsvars/orange');

/* eslint-disable no-param-reassign */
module.exports = (config) => {
config.module.rules.forEach((rule) => {
if (rule.test.toString() === /\.less$/.toString()) {
rule.use = [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
modifyVars,
},
},
];
}
});
};

0 comments on commit 4f0a173

Please sign in to comment.