Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -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);

notification.style.top = `${posTop}px`;
notification.style.right = `${posRight}px`;

const titleElement = document.createElement('h2');

titleElement.classList.add('title');
titleElement.textContent = title;

const descriptionElement = document.createElement('p');

descriptionElement.textContent = description;

notification.append(titleElement, descriptionElement);
document.body.appendChild(notification);

setTimeout(() => {
notification.style.display = 'none';
}, 2000);
};

pushNotification(
Expand Down