Skip to content

Commit 9ffd3dd

Browse files
committed
Fix footer positioning, add favicon and function to show library statistics
1 parent 7a35884 commit 9ffd3dd

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

css/styles.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#content {
2222
display: flex;
23-
height: 100vh;
23+
min-height: 100vh;
2424
font-family: "Montserrat-Regular", Arial, Helvetica, sans-serif;
2525
color: var(--blue);
2626
}
@@ -151,8 +151,9 @@ input[type=number] {
151151
}
152152

153153
#footer {
154-
position: absolute;
155-
bottom: 30px;
154+
position: fixed;
155+
bottom: 0;
156+
padding: 0 0 30px 0;
156157
}
157158
#crafted-by {
158159
margin-bottom: 0;

images/library-favicon.png

81.1 KB
Loading

index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="shortcut icon" type="image/jpg" href="images/library-favicon.png">
78
<link type="text/css" rel="stylesheet" href="css/modern-normalize.min.css">
89
<link type="text/css" rel="stylesheet" href="css/styles.css">
910
<link href="css/fontawesome.min.css" rel="stylesheet">
1011
<link href="css/duotone.min.css" rel="stylesheet">
1112
<link href="css/solid.min.css" rel="stylesheet">
12-
<title>📚 Library</title>
13+
<title>Library</title>
1314
</head>
1415

1516
<body id="content">
@@ -75,9 +76,9 @@ <h1 id="logo"><i class="fad fa-books theme-books"></i> Library</i></h1>
7576

7677
<main id="library-content">
7778
<div id="library-info">
78-
<p>BOOKS READ: <span>1</span></p>
79-
<p>BOOKS UNREAD: <span>1</span></p>
80-
<p>TOTAL BOOKS: <span>2</span></p>
79+
<p>BOOKS READ: <span id="books-read"></span></p>
80+
<p>BOOKS UNREAD: <span id="books-unread"></span></p>
81+
<p>TOTAL BOOKS: <span id="total-books"></span></p>
8182
</div>
8283

8384
<table id="books-list">

scripts.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ function addBookToLibrary(title, author, pages, status) {
1515
addBookToLibrary('Sapiens: A Brief History of Humankind', 'Yuval Noah Harari', '464', 'read');
1616
addBookToLibrary('The Lady of the Lake', 'Andrzej Sapkowski', '544', 'unread');
1717

18+
function showLibraryInfo() {
19+
let readCounter = 0;
20+
let unreadCounter = 0;
21+
for (let i = 0; i < myLibrary.length; i += 1) {
22+
if (myLibrary[i].status === 'read') {
23+
readCounter += 1;
24+
const booksRead = document.querySelector('#books-read');
25+
booksRead.textContent = readCounter;
26+
} else if (myLibrary[i].status === 'unread') {
27+
unreadCounter += 1;
28+
const booksUnread = document.querySelector('#books-unread');
29+
booksUnread.textContent = unreadCounter;
30+
}
31+
}
32+
const totalBooks = document.querySelector('#total-books');
33+
totalBooks.textContent = myLibrary.length;
34+
}
35+
showLibraryInfo();
36+
1837
function showBooksInLibrary() {
1938
for (let i = 0; i < myLibrary.length; i += 1) {
2039
const bookList = document.querySelector('#table-body');

0 commit comments

Comments
 (0)