Skip to content

Commit c81a03f

Browse files
committed
Update book-library to the latest version from JS3
I'm not sure how it ended up as weirdly broken as it did, but I'm pretty sure it wasn't intended.
1 parent 4fbe2bd commit c81a03f

File tree

8 files changed

+165
-204
lines changed

8 files changed

+165
-204
lines changed

debugging/book-library/book.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

debugging/book-library/book.test.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

debugging/book-library/books.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

debugging/book-library/books.test.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

debugging/book-library/index.html

Lines changed: 59 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,96 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html>
33
<head>
4-
<title>My Book Library</title>
4+
<title> </title>
5+
<meta
6+
charset="utf-8"
7+
name="viewport"
8+
content="width=device-width, initial-scale=1.0"
9+
/>
10+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
11+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
12+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
513
<link
6-
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
714
rel="stylesheet"
15+
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
816
/>
17+
<link rel="stylesheet" type="text/css" href="style.css" />
918
</head>
1019

11-
<body class="bg-gray-100 p-8 bg-gradient-to-r from-indigo-100">
12-
<h1 class="text-8xl font-bold mb-4">My Book Library</h1>
20+
<body>
21+
<div class="jumbotron text-center">
22+
<h1>Library</h1>
23+
<p>Add books to your virtual library</p>
24+
</div>
25+
26+
<button data-toggle="collapse" data-target="#demo" class="btn btn-info">
27+
Add new book
28+
</button>
1329

14-
<form id="add-book" class="bg-white p-4 rounded-lg shadow-md max-w-2xl">
15-
<div class="mb-4">
16-
<label for="titleInput" class="block font-bold">Title:</label>
30+
<div id="demo" class="collapse">
31+
<div class="form-group">
32+
<label for="title">Title:</label>
1733
<input
18-
id="titleInput"
19-
type="text"
20-
name="titleInput"
21-
class="border p-2 w-full"
34+
type="title"
35+
class="form-control"
36+
id="title"
37+
name="title"
2238
required
2339
/>
24-
</div>
25-
26-
<div class="mb-4">
27-
<label for="authorInput" class="block font-bold">Author:</label>
40+
<label for="author">Author: </label>
2841
<input
29-
id="authorInput"
30-
type="text"
31-
name="authorInput"
32-
class="border p-2 w-full"
42+
type="author"
43+
class="form-control"
44+
id="author"
45+
name="author"
3346
required
3447
/>
35-
</div>
36-
37-
<div class="mb-4">
38-
<label for="pagesInput" class="block font-bold">Pages:</label>
48+
<label for="pages">Pages:</label>
3949
<input
40-
id="pagesInput"
4150
type="number"
42-
name="pagesInput"
43-
class="border p-2 w-full"
44-
min="1"
51+
class="form-control"
52+
id="pages"
53+
name="pages"
4554
required
4655
/>
56+
<label class="form-check-label">
57+
<input
58+
type="checkbox"
59+
class="form-check-input"
60+
id="check"
61+
value=""
62+
/>Read
63+
</label>
64+
<input
65+
type="submit"
66+
value="Submit"
67+
class="btn btn-primary"
68+
onclick="submit();"
69+
/>
4770
</div>
71+
</div>
4872

49-
<div class="flex items-center mb-4">
50-
<input id="readInput" name="readInput" type="checkbox" class="mr-2" />
51-
<label for="readInput">Read</label>
52-
</div>
53-
54-
<button
55-
type="submit"
56-
class="bg-blue-500 text-white py-2 px-4 rounded-lg hover:bg-blue-600"
57-
>
58-
Add Book
59-
</button>
60-
</form>
61-
62-
<table class="bg-white rounded-lg shadow-md mt-8 w-full">
63-
<thead>
73+
<table class="table" id="display">
74+
<thead class="thead-dark">
6475
<tr>
6576
<th>Title</th>
6677
<th>Author</th>
67-
<th>Pages</th>
78+
<th>Number of Pages</th>
6879
<th>Read</th>
69-
<th>Remove</th>
80+
<th></th>
7081
</tr>
7182
</thead>
72-
<template id="book-row" class="max-w-3xl">
83+
<tbody>
7384
<tr>
7485
<td></td>
7586
<td></td>
7687
<td></td>
7788
<td></td>
7889
<td></td>
7990
</tr>
80-
</template>
91+
</tbody>
8192
</table>
8293

83-
<script>
84-
const bookRowTemplate = document.getElementById('book-row');
85-
const bookTable = document.querySelector('table');
86-
87-
const addBookForm = document.getElementById('add-book');
88-
const titleInput = document.getElementById('titleInput');
89-
const authorInput = document.getElementById('authorInput');
90-
const pagesInput = document.getElementById('pagesInput');
91-
const readInput = document.getElementById('readInput');
92-
93-
const books = [];
94-
95-
function addBook(e) {
96-
e.preventDefault();
97-
98-
const book = {
99-
title: titleInput.value,
100-
</script>
94+
<script src="script.js"></script>
10195
</body>
10296
</html>

debugging/book-library/index.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)