Move detail back navigation into header

This commit is contained in:
Arne
2026-08-06 21:05:30 +02:00
parent a735f1a8d4
commit 5757e6bbea
+10 -4
View File
@@ -5,7 +5,7 @@ import (
"github.com/arnef/ebooks/internal/library" "github.com/arnef/ebooks/internal/library"
) )
templ Layout(title string) { templ Layout(title string, backHref string) {
<!doctype html> <!doctype html>
<html lang="de"> <html lang="de">
<head> <head>
@@ -16,7 +16,14 @@ templ Layout(title string) {
</head> </head>
<body> <body>
<header class="header"> <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> <h1><a href="/">eBook Library</a></h1>
</div>
</header> </header>
<main class="container"> <main class="container">
{ children... } { children... }
@@ -36,7 +43,7 @@ templ BookCover(book library.Book, detail bool) {
} }
templ IndexPage(books []library.Book) { templ IndexPage(books []library.Book) {
@Layout("Bibliothek") { @Layout("Bibliothek", "") {
<section class="page-head"> <section class="page-head">
<h2>Meine Bücher</h2> <h2>Meine Bücher</h2>
<p class="page-subtitle">Titel, Autor und Cover auf einen Blick.</p> <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) { templ BookPage(book library.Book) {
@Layout(book.Title) { @Layout(book.Title, "/") {
<article class="book-detail"> <article class="book-detail">
<div class="book-detail-cover"> <div class="book-detail-cover">
@BookCover(book, true) @BookCover(book, true)
</div> </div>
<div class="book-detail-body"> <div class="book-detail-body">
<p><a class="back-link" href="/"> Zurück zur Liste</a></p>
<h2>{ book.Title }</h2> <h2>{ book.Title }</h2>
<p class="book-author-detail">{ book.Author }</p> <p class="book-author-detail">{ book.Author }</p>
<dl class="book-meta"> <dl class="book-meta">