diff --git a/src/scripts/main.js b/src/scripts/main.js index 35d0d8f74..34e8d9285 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -2,6 +2,28 @@ const pushNotification = (posTop, posRight, title, description, type) => { // write code here + const notification = document.createElement('div'); + + notification.classList.add('notification', type); + + notification.style.top = `${posTop}px`; + notification.style.right = `${posRight}px`; + + const titleNode = document.createElement('h2'); + + titleNode.classList.add('title'); + titleNode.textContent = title; + + const descriptionNode = document.createElement('p'); + + descriptionNode.textContent = description; + + notification.append(titleNode, descriptionNode); + document.body.prepend(notification); + + setTimeout(() => { + notification.style.display = 'none'; + }, 2000); }; pushNotification(