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.
|
|
|
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: messageText,
|
|
|
|
backgroundColor: color,
|
|
|
|
easing: 'easeInOutQuint',
|
|
|
|
duration: 500,
|
|
|
|
complete: () => {
|
|
|
|
setTimeout(() => {
|
|
|
|
anime({
|
|
|
|
targets: messageText,
|
|
|
|
backgroundColor: '#374857',
|
|
|
|
easing: 'easeOutQuint',
|
|
|
|
duration: 500
|
|
|
|
});
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
anime({
|
|
|
|
targets: message,
|
|
|
|
marginTop: '-20px',
|
|
|
|
easing: 'easeInOutQuint',
|
|
|
|
duration: 500,
|
|
|
|
opacity: 1,
|
|
|
|
complete: () => {
|
|
|
|
setTimeout(() => {
|
|
|
|
anime({
|
|
|
|
targets: message,
|
|
|
|
marginTop: '-125px',
|
|
|
|
easing: 'easeOutQuint',
|
|
|
|
duration: 500,
|
|
|
|
opacity: 0,
|
|
|
|
complete: () => {
|
|
|
|
notifcation.style.display = 'none';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------
|
|
|
|
// event handlers
|
|
|
|
//--------------------------
|
|
|
|
}
|