Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/art-deco. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FooterBlockMeta defines the Art Deco footer block.
|
|
var FooterBlockMeta = blocks.BlockMeta{
|
|
Key: "footer",
|
|
Title: "Footer",
|
|
Description: "Centered Art Deco footer with gold rule, address, reservations email and optional social row.",
|
|
Source: "art-deco",
|
|
}
|
|
|
|
// FooterData is the typed view for the footer component.
|
|
type FooterData struct {
|
|
Address string
|
|
ReservationsEmail string
|
|
ShowSocial bool
|
|
MenuName string
|
|
}
|
|
|
|
// FooterBlock renders the centered Art Deco footer.
|
|
// Content: {"address": "...", "reservationsEmail": "...", "showSocial": "true|false", "menuName": "..."}
|
|
func FooterBlock(ctx context.Context, content map[string]any) string {
|
|
// showSocial is stored as a string select ("true"/"false"); also accept bool for flexibility.
|
|
showSocial := true
|
|
if b, ok := content["showSocial"].(bool); ok {
|
|
showSocial = b
|
|
} else if s := getString(content, "showSocial"); s != "" {
|
|
showSocial = s != "false"
|
|
}
|
|
|
|
data := FooterData{
|
|
Address: getString(content, "address"),
|
|
ReservationsEmail: getString(content, "reservationsEmail"),
|
|
ShowSocial: showSocial,
|
|
MenuName: getString(content, "menuName"),
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = footerComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|