Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It's an expected result of your job:

### General instructions

1. Replace `<your_account>` with your GitHub username in the link
1. Replace `jkumorek01` with your GitHub username in the link
- [DEMO LINK](https://<your_account>.github.io/js_notification_DOM/)
2. Follow [this instructions](https://mate-academy.github.io/layout_task-guideline/)
- Run `npm run test` command to test your code;
Expand Down
21 changes: 20 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
'use strict';

const pushNotification = (posTop, posRight, title, description, type) => {
// write code here
const container = document.createElement('div');
const titleElement = document.createElement('h2');
const text = document.createElement('p');

container.classList.add('notification', type);
titleElement.classList.add('title');

titleElement.textContent = title;
text.textContent = description;

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

container.append(titleElement, text);

document.body.append(container);

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

pushNotification(
Expand Down
Loading