Initial MVP: Go + templ Tolino-optimized ebook library scaffold
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package views
|
||||
|
||||
import "github.com/arnef/ebooks/internal/library"
|
||||
|
||||
templ Layout(title string) {
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>{ title }</title>
|
||||
<link rel="stylesheet" href="/static/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<h1><a href="/">eBook Library</a></h1>
|
||||
</header>
|
||||
<main class="container">
|
||||
{ children... }
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
templ IndexPage(books []library.Book) {
|
||||
@Layout("Bibliothek") {
|
||||
<h2>Meine Bücher</h2>
|
||||
if len(books) == 0 {
|
||||
<p>Keine eBooks gefunden. Lege EPUB- oder PDF-Dateien im Ordner <code>books/</code> ab.</p>
|
||||
} else {
|
||||
<ul class="book-list">
|
||||
for _, b := range books {
|
||||
<li class="book-item">
|
||||
<a class="book-link" href={ "/book/" + b.ID }>{ b.Title }</a>
|
||||
<span class="format">{ b.Format }</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ BookPage(book library.Book) {
|
||||
@Layout(book.Title) {
|
||||
<article>
|
||||
<h2>{ book.Title }</h2>
|
||||
<p><strong>Datei:</strong> { book.Filename }</p>
|
||||
<p><strong>Format:</strong> { book.Format }</p>
|
||||
<p><a class="btn" href={ "/download/" + book.ID }>Auf Tolino herunterladen</a></p>
|
||||
<p><a href="/">← Zurück zur Liste</a></p>
|
||||
</article>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package views
|
||||
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
|
||||
var _ templ.Component
|
||||
Reference in New Issue
Block a user