Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit fefaad9

Browse files
author
Your Name
committed
changed according to Altoms feedback
1 parent 39451d9 commit fefaad9

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

week-3/reading-list/index.html

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
<!DOCTYPE >
1+
<!DOCTYPE>
22
<html lang="en_US">
3-
<head>
4-
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<link rel="stylesheet" href="style.css" />
7-
8-
<title>Reading list app</title>
9-
</head>
10-
<body>
11-
<div id="content">
12-
<ul id="reading-list"></ul>
13-
</div>
14-
<script src="script.js"></script>
15-
</body>
16-
</html>
173

4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<link rel="stylesheet" href="style.css" />
188

19-
<!-- <div id="content">
20-
<ul id="reading-list">
21-
<li id="list-of-books">
22-
<p>book title</p>
23-
<p>book author</p>
24-
<img <p>books cover img url</p> />
25-
</li>
26-
</ul>
27-
</div> -->
9+
<title>Reading list app</title>
10+
</head>
11+
12+
<body>
13+
<div id="content">
14+
<ul id="reading-list"></ul>
15+
</div>
16+
<script src="script.js"></script>
17+
</body>
18+
19+
</html>

week-3/reading-list/script.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,25 @@ const books = [
2525

2626
const getReadingList = document.getElementById("content");
2727
const listOfBooks = document.getElementById("reading-list");
28-
console.log(getReadingList);
2928

30-
for (const item of books){
29+
for (const item of books) {
3130
const li = document.createElement("li");
32-
listOfBooks.appendChild(li);
31+
3332

3433
const p = document.createElement("p");
35-
li.appendChild(p);
3634
p.textContent = `${item.title} by ${item.author}`;
3735

3836
const image = document.createElement("img");
39-
li.appendChild(image);
4037
image.src = item.bookCoverImage;
4138

42-
if (item.alreadyRead === true){li.setAttribute("class", "green")}
43-
else {li.setAttribute("class", "red")}
39+
if (item.alreadyRead === true) {
40+
li.setAttribute("class", "green")
41+
} else {
42+
li.setAttribute("class", "red")
43+
}
44+
45+
46+
listOfBooks.appendChild(li);
47+
li.appendChild(p);
48+
li.appendChild(image);
4449
}

0 commit comments

Comments
 (0)