From 55d14cfdb690ce588ec44c576c1a5d528704bedc Mon Sep 17 00:00:00 2001 From: Oksana Zakharevych Date: Tue, 28 Apr 2026 16:29:52 +0200 Subject: [PATCH] add solution --- src/scripts/main.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 35d0d8f74..19969fd05 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,7 +1,29 @@ 'use strict'; const pushNotification = (posTop, posRight, title, description, type) => { - // write code here + const notificationElement = document.createElement('div'); + + notificationElement.className = `notification ${type}`; + + notificationElement.style.top = `${posTop}px`; + notificationElement.style.right = `${posRight}px`; + + const titleElement = document.createElement('h2'); + + titleElement.className = 'title'; + titleElement.textContent = title; + + const descriptionElement = document.createElement('p'); + + descriptionElement.textContent = description; + + notificationElement.appendChild(titleElement); + notificationElement.appendChild(descriptionElement); + document.body.appendChild(notificationElement); + + setTimeout(() => { + notificationElement.style.display = 'none'; + }, 2000); }; pushNotification(