-
-
Notifications
You must be signed in to change notification settings - Fork 221
Glasgow | 25-ITP-SEP | Hanna Mykytiuk| Sprint 3| Reading-list #857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,36 @@ | ||
| document.addEventListener("DOMContentLoaded", () => { | ||
| //elements of page to interact with | ||
| for (let book of books){ | ||
| const title = book.title; | ||
| const author = book.author; | ||
| const alreadyRead = book.alreadyRead; | ||
| const bookCoverImage = book.bookCoverImage; | ||
|
Comment on lines
+4
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job with this.
|
||
| const readingListDom = document.getElementById("reading-list") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to initialize the readingListDom object inside this block. Could you look into why that would be problematic? |
||
|
|
||
| let bookDiv = document.createElement("div"); | ||
| bookDiv.classList.add("book"); | ||
| if (alreadyRead == true){ | ||
| bookDiv.classList.add("alreadyRead"); | ||
| } | ||
| let titleDom = document.createElement("p"); | ||
| titleDom.innerText = title; | ||
| let authorDom = document.createElement("p"); | ||
| authorDom.innerText = author; | ||
| let imageDom = document.createElement("img"); | ||
| imageDom.src = bookCoverImage; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. Although |
||
|
|
||
|
|
||
| bookDiv.appendChild(titleDom); | ||
| bookDiv.appendChild(authorDom); | ||
| bookDiv.appendChild(imageDom); | ||
|
|
||
| readingListDom.appendChild(bookDiv); | ||
| } | ||
|
|
||
| }); | ||
|
|
||
|
|
||
|
|
||
| // for the tests, do not modify this array of books | ||
| const books = [ | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,3 +157,9 @@ body { | |
| max-height: 80px; | ||
| } | ||
| } | ||
| .book{ | ||
| background-color: red; | ||
| } | ||
| .alreadyRead{ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this will work fine, css classes are typically not written in |
||
| background-color: green; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌