themes-editorial/colophon.templ
Alex Dunmow 1d9a4c8ce6 initial: theme plugin editorial
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/editorial.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:28 +08:00

46 lines
1.4 KiB
Plaintext

package main
// colophonComponent renders the editorial colophon (footer). Subscribe stub,
// link list, and ISSN are all optional. The stub is a non-functional stand-in
// for this build pass — the spec lists the colophon as a footer with a
// subscribe stub, but signup wiring is out of scope.
templ colophonComponent(data ColophonData) {
<div class="editorial-wide editorial-colophon" data-block="editorial:colophon">
if data.ShowSignup {
<div class="mb-4">
<div class="editorial-section-label mb-1">{ "Subscribe" }</div>
<form class="flex gap-2 max-w-md">
<input type="email" placeholder="you@example.com" class="flex-1 px-3 py-1 border editorial-hairline" aria-label="Email address"/>
<button type="submit" class="editorial-button">{ "Subscribe" }</button>
</form>
</div>
}
if len(data.Links) > 0 {
<nav aria-label="Footer">
<ul class="flex flex-wrap gap-x-4 gap-y-1">
for _, link := range data.Links {
<li>
<a href={ templ.SafeURL(linkHref(link.URL)) } class="editorial-button" style="border:0;padding:0;letter-spacing:0.05em;">
{ link.Text }
</a>
</li>
}
</ul>
</nav>
}
if data.ISSN != "" {
<div class="mt-3">
<span class="editorial-colophon-issn">{ "ISSN " }{ data.ISSN }</span>
</div>
}
</div>
}
// linkHref returns "#" for empty URLs so the rendered href is always valid.
func linkHref(u string) string {
if u == "" {
return "#"
}
return u
}