diff --git a/src/scripts/main.js b/src/scripts/main.js index 35d0d8f74..2179b303f 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -2,6 +2,29 @@ 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 titleElement = document.createElement('h2'); + + titleElement.className = 'title'; + titleElement.textContent = title; + + notification.appendChild(titleElement); + + const descriptionElement = document.createElement('p'); + + descriptionElement.textContent = description; + notification.appendChild(descriptionElement); + + document.body.appendChild(notification); + + setTimeout(() => { + notification.style.visibility = 'hidden'; + }, 2000); }; pushNotification(