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
7 changes: 3 additions & 4 deletions Sprint-3/reading-list/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
<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">
<ul id="reading-list"></ul>
</div>
<h1>My Reading List</h1>
<div id="book-list"></div>
<script src="script.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions Sprint-3/reading-list/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,25 @@ const books = [
},
];

function readingList(books) {
const bookList = document.getElementById("book-list");

books.forEach((book) => {
const card = document.createElement("div");
card.classList.add("book-card");
card.classList.add(book.alreadyRead ? "read" : "unread");

card.innerHTML = `
<img src="${book.bookCoverImage}" alt="${book.title}" />
<div>
<h2>${book.title}</h2>
<p>By ${book.author}</p>
<p>${book.alreadyRead ? "Already read ✅" : "Not read yet 📖"}</p>
</div>
`;

bookList.appendChild(card);
});
}

readingList(books);
24 changes: 23 additions & 1 deletion Sprint-3/reading-list/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ body {
"Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.book-card {
padding: 20px;
margin: 15px;
border-radius: 8px;
display: flex;
align-items: center;
gap: 20px;
}

.book-card img {
height: 150px;
width: auto;
}

.read {
background-color: green;
}

.unread {
background-color: red;
}

.site-footer {
margin-top: 4em;
}
Expand Down Expand Up @@ -133,7 +155,7 @@ body {
height: 37px;
}

.colorButton {
.colorBtn {
margin-bottom: 20px;
margin-right: 20px;
width: 100px;
Expand Down
Loading