mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
Repair eslint wraning (#2453)
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
import Toast from './toast'
|
||||
import Toast from './toast';
|
||||
|
||||
export default Toast;
|
||||
|
@@ -7,7 +7,7 @@ class NoticeContainer extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.transitionTime = 300;
|
||||
this.state = {notices: []}
|
||||
this.state = {notices: []};
|
||||
}
|
||||
|
||||
addNotice = (notice) => {
|
||||
|
@@ -4,37 +4,37 @@ import NoticeContainer from './notice-container';
|
||||
import './toast.css';
|
||||
|
||||
function createNotieContainer() {
|
||||
const div = document.createElement('div')
|
||||
document.body.appendChild(div)
|
||||
const noticeContainer = ReactDOM.render(<NoticeContainer />, div)
|
||||
const div = document.createElement('div');
|
||||
document.body.appendChild(div);
|
||||
const noticeContainer = ReactDOM.render(<NoticeContainer />, div);
|
||||
return {
|
||||
addNotice(notice) {
|
||||
return noticeContainer.addNotice(notice)
|
||||
},
|
||||
destroy() {
|
||||
ReactDOM.unmountComponentAtNode(div)
|
||||
document.body.removeChild(div)
|
||||
}
|
||||
}
|
||||
addNotice(notice) {
|
||||
return noticeContainer.addNotice(notice);
|
||||
},
|
||||
destroy() {
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
document.body.removeChild(div);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let noticeContainer
|
||||
let noticeContainer = null;
|
||||
const notice = (type, content, duration = 2000, onClose) => {
|
||||
if (!noticeContainer) noticeContainer = createNotieContainer()
|
||||
return noticeContainer.addNotice({ type, content, duration, onClose })
|
||||
}
|
||||
if (!noticeContainer) noticeContainer = createNotieContainer();
|
||||
return noticeContainer.addNotice({ type, content, duration, onClose });
|
||||
};
|
||||
|
||||
export default {
|
||||
info(content, duration, onClose) {
|
||||
return notice('info', content, duration, onClose)
|
||||
return notice('info', content, duration, onClose);
|
||||
},
|
||||
success(content, duration, onClose) {
|
||||
return notice('success', content, duration, onClose)
|
||||
return notice('success', content, duration, onClose);
|
||||
},
|
||||
warning(content, duration, onClose) {
|
||||
return notice('warning', content, duration, onClose)
|
||||
return notice('warning', content, duration, onClose);
|
||||
},
|
||||
error(content, duration, onClose) {
|
||||
return notice('danger', content, duration, onClose)
|
||||
return notice('danger', content, duration, onClose);
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user