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
22 changes: 21 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
'use strict';

const pushNotification = (posTop, posRight, title, description, type) => {
// write code here
const node = document.createElement('div');
const titleNode = document.createElement('h2');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You create the title h2 node but never give it the required title class. Per checklist items #7 and #13 add titleNode.classList.add('title') so the element has the expected class.

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

node.classList.add(`notification`, type);
titleNode.classList.add('title');

node.style.top = posTop + 'px';
node.style.right = posRight + 'px';

node.append(titleNode);
node.append(descripNode);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The notification node is never appended to the document, so it will not be visible. Append it (for example document.body.append(node)), ideally after setting its content and classes to satisfy checklist item #3.

titleNode.innerText = title;
descripNode.innerText = description;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must hide the message visually after 2 seconds instead of removing it from the DOM. Use setTimeout to change a style property (e.g., node.style.display = 'none' or node.style.visibility = 'hidden') after 2000ms to satisfy checklist items #4, #12 and #15.


document.body.append(node);

setTimeout(() => {
node.style.visibility = 'hidden';
}, 2000);
};

pushNotification(
Expand Down
Loading