132 lines
3.8 KiB
HTML
132 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>Next Book</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta property="og:title" content="Next Book" />
|
|
<meta property="og:description" content="Suggestions for the next book to read from your Storygraph to-read pile" />
|
|
|
|
|
|
<link rel="stylesheet" href="assets/css/normalize.css">
|
|
<link rel="stylesheet" href="assets/css/skeleton.css">
|
|
<style>
|
|
header {
|
|
text-align: center;
|
|
padding: 2rem;
|
|
background-color: #f9f9f9;
|
|
}
|
|
|
|
main {
|
|
display: grid;
|
|
grid-template-columns: repeat(12, 1fr);
|
|
margin: 8px 16px;
|
|
}
|
|
|
|
.category {
|
|
padding: 1rem;
|
|
margin: 1rem;
|
|
border: 1px solid #ccc;
|
|
border-radius: 5px;
|
|
background-color: #f9f9f9;
|
|
|
|
display: grid;
|
|
text-align: center;
|
|
grid-template-columns: 1fr;
|
|
grid-template-rows: 47px 250px auto 40px;
|
|
|
|
grid-column: span 2;
|
|
}
|
|
|
|
.rating {
|
|
font-weight: bold;
|
|
padding: 6px;
|
|
}
|
|
|
|
main > .category:nth-of-type(1),
|
|
main > .category:nth-of-type(2),
|
|
main > .category:nth-of-type(3) {
|
|
grid-column: span 4;
|
|
}
|
|
|
|
@media screen and (max-width: 768px) {
|
|
main {
|
|
grid-template-columns: repeat(1, 1fr);
|
|
}
|
|
|
|
main > .category:nth-of-type(1),
|
|
main > .category:nth-of-type(2),
|
|
main > .category:nth-of-type(3) {
|
|
grid-column: span 2;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Next Book</h1>
|
|
<p>Suggestions for the next book to read from your Storygraph to-read pile</p>
|
|
{{ if .Refreshing }}
|
|
<div>Refreshing recommendations...</div>
|
|
{{ else if .LastUpdated }}
|
|
<div>
|
|
Last Update: {{ .LastUpdated }}
|
|
<a href="/refresh">Refresh recommendations</a>
|
|
</div>
|
|
{{ end }}
|
|
</header>
|
|
{{ if index .Books "Fiction" }}
|
|
<main>
|
|
{{ $cat := "Fiction" }}
|
|
{{ $book := index .Books $cat }}
|
|
<div class="category">
|
|
<h3>{{ $cat }}</h3>
|
|
<a href="{{ $book.Link }}" target="_blank">
|
|
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
|
|
</a>
|
|
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
|
|
<div class="rating">⭐ {{ $book.Rating }}</div>
|
|
</div>
|
|
{{ $cat := "Non-Fiction" }}
|
|
{{ $book := index .Books $cat }}
|
|
<div class="category">
|
|
<h3>{{ $cat }}</h3>
|
|
<a href="{{ $book.Link }}" target="_blank">
|
|
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
|
|
</a>
|
|
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
|
|
<div class="rating">⭐ {{ $book.Rating }}</div>
|
|
</div>
|
|
{{ $cat := "Comics" }}
|
|
{{ $book := index .Books $cat }}
|
|
<div class="category">
|
|
<h3>{{ $cat }}</h3>
|
|
<a href="{{ $book.Link }}" target="_blank">
|
|
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
|
|
</a>
|
|
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
|
|
<div class="rating">⭐ {{ $book.Rating }}</div>
|
|
</div>
|
|
|
|
{{ range $cat, $book := .Books }}
|
|
{{ if or (eq $cat "Fiction") (eq $cat "Non-Fiction") (eq $cat "Comics") }}
|
|
{{ continue }}
|
|
{{ end }}
|
|
<div class="category">
|
|
<h3>{{ $cat }}</h3>
|
|
<a href="{{ $book.Link }}" target="_blank">
|
|
<img src="{{ $book.Image }}" alt="{{ $book.Name }} cover" style="height: 250px;" />
|
|
</a>
|
|
<a href="{{ $book.Link }}" target="_blank">{{ $book.Name }}</a>
|
|
<div class="rating">⭐ {{ $book.Rating }}</div>
|
|
</div>
|
|
{{ end }}
|
|
</main>
|
|
{{ else }}
|
|
<div class="container" style="text-align: center;padding: 4rem;">
|
|
<h2>Still loading book recommendations...</h2>
|
|
</div>
|
|
{{ end }}
|
|
</body>
|
|
</html>
|