From 7e1a18758e3546e106a4675fc0bb6daacfb1d259 Mon Sep 17 00:00:00 2001 From: Alisa Skrypnyk Date: Thu, 30 Apr 2026 15:55:26 +0300 Subject: [PATCH] add solution --- src/scripts/main.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 35d0d8f74..18374f6b8 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,7 +1,30 @@ 'use strict'; 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 notificationTitle = document.createElement('h2'); + + notificationTitle.classList.add('title'); + notificationTitle.textContent = title; + + const notificationDesc = document.createElement('p'); + + notificationDesc.textContent = description; + + notification.appendChild(notificationTitle); + notification.appendChild(notificationDesc); + + document.body.appendChild(notification); + + setTimeout(() => { + notification.style.display = 'none'; + }, 2000); }; pushNotification(