You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fipamo/src/com/ui/Notifications.js

48 lines
1.1 KiB
JavaScript

import anime from 'animejs/lib/anime.es.js';
const notifcation = document.getElementById('notifications');
const message = document.getElementById('notifyMessage');
const messageText = document.getElementById('message-text');
export default class Notfications {
//--------------------------
// constructor
//--------------------------
constructor() {}
//--------------------------
// methods
//--------------------------
alert(text, status) {
messageText.innerHTML = text;
notifcation.style.display = 'flex';
var color = '';
status ? (color = '#32cd32') : (color = '#F64747');
anime({
targets: message,
marginTop: '-20px',
backgroundColor: color,
easing: 'easeInOutQuint',
duration: 500,
opacity: 1,
complete: () => {
setTimeout(() => {
anime({
targets: message,
marginTop: '-125px',
backgroundColor: '#374857',
easing: 'easeOutQuint',
duration: 500,
opacity: 0,
complete: () => {
notifcation.style.display = 'none';
}
});
}, 1000);
}
});
}
//--------------------------
// event handlers
//--------------------------
}