From a41b487088034e7e09e5b34d003f3a156a5660e9 Mon Sep 17 00:00:00 2001 From: Doheera-kosi Date: Mon, 3 Oct 2022 18:30:18 +0000 Subject: [PATCH 1/2] Update READMEmd --- README.md | 7 ------- index.js | 10 ++++++++-- modules/collectionClass.js | 2 +- modules/pushItems.js | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 164d258..d1f13d4 100644 --- a/README.md +++ b/README.md @@ -73,13 +73,6 @@ N/A - GitHub: [@githubhandle](https://github.com/doheera-kosi) - LinkedIn: [LinkedIn](https://www.linkedin.com/in/evans-kupour-1879421a3/) -👤 **Author2** -## Nejjari Abdelhafid - -- GitHub: [@Nejjari001](https://github.com/Nejjari001) -- Twitter: [@AbdoNJ19](https://https://twitter.com/AbdoNJ19) -- LinkedIn: [Abdelhafid Nejjari](https://www.linkedin.com/in/abdelhafid-nejjari/) - ## 🤝 Contributing diff --git a/index.js b/index.js index 46cdc41..45b2ff5 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import { pushItems } from './modules/pushItems.js'; +import { pushItems, elements } from './modules/pushItems.js'; import { Collection } from './modules/collectionClass.js'; import { } from './modules/time.js'; // Declaring Global Variables @@ -19,6 +19,12 @@ window.onload = () => { collection.getBooks(); }; +elements.addEventListener('click', (e) => { + if (e.target.tagName === 'BUTTON') { + collection.removeBook(e.target.id); + } +}); + const addBtn = document.querySelector('.addBtn'); // event Listener to triger add Class @@ -32,7 +38,7 @@ navList.addEventListener('click', () => { sectionList.style.display = 'block'; sectionAdd.style.display = 'none'; sectionContact.style.display = ' none'; - pushItems(); + pushItems(collection); }); navAdd.addEventListener('click', () => { diff --git a/modules/collectionClass.js b/modules/collectionClass.js index 458883c..0b803f0 100644 --- a/modules/collectionClass.js +++ b/modules/collectionClass.js @@ -44,7 +44,7 @@ export class Collection { pushItems(); } } -export const collection = new Collection(); +const collection = new Collection(); // window onload function to get array items from the local storage and display them window.onload = () => { diff --git a/modules/pushItems.js b/modules/pushItems.js index aac7f37..5ac16f4 100644 --- a/modules/pushItems.js +++ b/modules/pushItems.js @@ -7,8 +7,8 @@ export function pushItems() { booksArray.forEach((item, index) => { bookHtml += `
  • -

    "${item.title}" by ${item.author}


    - +

    "${item.title}" by ${item.author}


    +
  • `; }); From 68d7927bb0ce014cc1b9bee937afe9c5c63e1376 Mon Sep 17 00:00:00 2001 From: Doheera-kosi Date: Mon, 3 Oct 2022 19:20:06 +0000 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1f13d4..bbb0a4a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://img.shields.io/badge/Microverse-blueviolet) -# Awesome Books +# Awesome books: with ES6 > Description the project.