From d8f950539499e95ff2b48543a647ba302426c556 Mon Sep 17 00:00:00 2001 From: Mykhailo Oliinyk Date: Mon, 1 Jun 2026 11:38:05 +0300 Subject: [PATCH] Solution --- src/scripts/main.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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(