Add eslint rule padding-line-between-statements (#1593)

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti authored and GitHub committed 2020-12-02 09:55:52 +02:00
1 parent 7b77f18376
commit dcf253e7d5
401 files changed
+2018 -40

No files matched your search

@@ -32,10 +32,13 @@ export class NotificationsStore {
addAutoHideTimer(id: NotificationId) {
const notification = this.getById(id);
if (!notification) return;
this.removeAutoHideTimer(id);
if (notification?.timeout) {
const timer = window.setTimeout(() => this.remove(id), notification.timeout);
this.autoHideTimers.set(id, timer);
}
}
@@ -53,12 +56,14 @@ export class NotificationsStore {
notification.id = uniqueId("notification_")
);
const index = this.notifications.findIndex(item => item.id === id);
if (index > -1) {
this.notifications.splice(index, 1, notification); // update existing with same id
} else {
this.notifications.push(notification); // add new
}
this.addAutoHideTimer(id);
return () => this.remove(id);
}
@@ -58,19 +58,23 @@ export class Notifications extends React.Component {
getMessage(notification: Notification) {
let { message } = notification;
if (message instanceof JsonApiErrorParsed) {
message = message.toString();
}
return React.Children.toArray(message);
}
render() {
const { notifications, remove, addAutoHideTimer, removeAutoHideTimer } = notificationsStore;
return (
<div className="Notifications flex column align-flex-end" ref={e => this.elem = e}>
{notifications.map(notification => {
const { id, status } = notification;
const msgText = this.getMessage(notification);
return (
<Animate key={id}>
<div