themes-gotham/footer.templ

64 lines
1.7 KiB
Plaintext

package main
// footerComponent renders a Gotham-styled multi-column footer.
// Note: The <footer> wrapper element is handled by the block wrapper (render/blocks.go)
templ footerComponent(data FooterData) {
<div class="max-w-6xl mx-auto px-4">
if len(data.Columns) > 0 {
<div class={ "grid gap-8 mb-12", footerGridCols(len(data.Columns)) }>
for _, col := range data.Columns {
<div>
if col.Heading != "" {
<h4 class="text-lg font-semibold gotham-accent mb-4">{ col.Heading }</h4>
}
if len(col.Links) > 0 {
<ul class="space-y-2">
for _, link := range col.Links {
<li>
<a href={ templ.SafeURL(getLinkURL(link)) } class="text-muted-foreground hover:text-foreground transition-colors">
{ link.Text }
</a>
</li>
}
</ul>
}
</div>
}
</div>
}
if data.Copyright != "" {
<div class="pt-8 gotham-border border-t text-center">
<p class="text-muted-foreground text-sm">{ data.Copyright }</p>
</div>
}
</div>
}
// footerGridCols returns grid column class for footer.
func footerGridCols(count int) string {
switch count {
case 1:
return "grid-cols-1"
case 2:
return "grid-cols-1 md:grid-cols-2"
case 3:
return "grid-cols-1 md:grid-cols-3"
default:
return "grid-cols-1 md:grid-cols-2 lg:grid-cols-4"
}
}
// getLinkURL returns the appropriate URL for a footer link.
// If PageID is set, constructs an internal link. Otherwise returns the URL.
func getLinkURL(link FooterLink) string {
if link.PageID != "" {
// Internal page links use the page ID as slug placeholder
// In production, this would be resolved to the actual page slug
return "/pages/" + link.PageID
}
if link.URL != "" {
return link.URL
}
return "#"
}