Skip to content

London | ITP-May-2025 | Hibo Sharif | Module-Data-Group | Reading-List #641

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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 Sprint-3/reading-list/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Title here</title>
<title>Reading list app</title>
</head>
<body>
<div id="content">
Expand Down
25 changes: 25 additions & 0 deletions Sprint-3/reading-list/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,28 @@ const books = [
},
];

function readingList(books) {
const container = document.getElementById("reading-list");
if (!container) return;

for (let i = 0; i < books.length; i++) {
const book = books[i];

const bookItem = document.createElement("div");
bookItem.className = "book";
bookItem.style.backgroundColor = book.alreadyRead ? "green" : "red";

const bookInfo = document.createElement("div");
bookInfo.innerHTML = `<h3>${book.title}</h3><p>${book.author}<p>`;

const img = document.createElement("img");
img.src = book.bookCoverImage;
img.alt = `${book.title} cover`;

bookItem.appendChild(img);
bookItem.appendChild(bookInfo);
container.appendChild(bookItem);
}
}

readingList(books);
2 changes: 1 addition & 1 deletion Sprint-3/reading-list/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Lesson: 1,2
* Class: Scotland 2017
*/

html,
body {
font-family: "Source Sans Pro", -apple-system, system-ui, BlinkMacSystemFont,
Expand Down