Move detail back navigation into header
This commit is contained in:
+10
-4
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/arnef/ebooks/internal/library"
|
||||
)
|
||||
|
||||
templ Layout(title string) {
|
||||
templ Layout(title string, backHref string) {
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
@@ -16,7 +16,14 @@ templ Layout(title string) {
|
||||
</head>
|
||||
<body>
|
||||
<header class="header">
|
||||
<div class="header-bar">
|
||||
if backHref != "" {
|
||||
<a class="header-back" href={ backHref }>← Zurück</a>
|
||||
} else {
|
||||
<span class="header-back header-back-placeholder" aria-hidden="true"></span>
|
||||
}
|
||||
<h1><a href="/">eBook Library</a></h1>
|
||||
</div>
|
||||
</header>
|
||||
<main class="container">
|
||||
{ children... }
|
||||
@@ -36,7 +43,7 @@ templ BookCover(book library.Book, detail bool) {
|
||||
}
|
||||
|
||||
templ IndexPage(books []library.Book) {
|
||||
@Layout("Bibliothek") {
|
||||
@Layout("Bibliothek", "") {
|
||||
<section class="page-head">
|
||||
<h2>Meine Bücher</h2>
|
||||
<p class="page-subtitle">Titel, Autor und Cover auf einen Blick.</p>
|
||||
@@ -65,13 +72,12 @@ templ IndexPage(books []library.Book) {
|
||||
}
|
||||
|
||||
templ BookPage(book library.Book) {
|
||||
@Layout(book.Title) {
|
||||
@Layout(book.Title, "/") {
|
||||
<article class="book-detail">
|
||||
<div class="book-detail-cover">
|
||||
@BookCover(book, true)
|
||||
</div>
|
||||
<div class="book-detail-body">
|
||||
<p><a class="back-link" href="/">← Zurück zur Liste</a></p>
|
||||
<h2>{ book.Title }</h2>
|
||||
<p class="book-author-detail">{ book.Author }</p>
|
||||
<dl class="book-meta">
|
||||
|
||||
Reference in New Issue
Block a user