From 1d02aa4f39794429771fd78c63e1b79255192508 Mon Sep 17 00:00:00 2001 From: Alibobick Date: Thu, 30 Apr 2026 16:21:50 +0300 Subject: [PATCH] add task solution --- src/scripts/main.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/scripts/main.js b/src/scripts/main.js index 35d0d8f74..6dd775729 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -1,7 +1,28 @@ 'use strict'; const pushNotification = (posTop, posRight, title, description, type) => { - // write code here + const notification = document.createElement('div'); + + notification.classList.add('notification', type); + + const titleElement = document.createElement('h2'); + + titleElement.classList.add('title'); + titleElement.textContent = title; + notification.appendChild(titleElement); + + const descriptionElement = document.createElement('p'); + + descriptionElement.textContent = description; + notification.appendChild(descriptionElement); + + notification.style.top = posTop + 'px'; + notification.style.right = posRight + 'px'; + document.body.appendChild(notification); + + setTimeout(() => { + notification.style.display = 'none'; + }, 2000); }; pushNotification(