Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/y2k. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FooterChromeBlockMeta declares the chrome footer block.
|
|
var FooterChromeBlockMeta = blocks.BlockMeta{
|
|
Key: "footer_chrome",
|
|
Title: "Chrome Footer",
|
|
Description: "Beveled chrome footer strip with optional webring and copyright.",
|
|
Source: "y2k",
|
|
Category: blocks.CategoryLayout,
|
|
}
|
|
|
|
// FooterChromeBlock renders the footer.
|
|
// Content: {menuName, showWebring, copyright}
|
|
func FooterChromeBlock(ctx context.Context, content map[string]any) string {
|
|
// showWebring is stored as either bool (legacy/master-page seed) or string
|
|
// ("yes" | "no") from the schema's select editor.
|
|
show := true
|
|
switch v := content["showWebring"].(type) {
|
|
case bool:
|
|
show = v
|
|
case string:
|
|
show = v != "no"
|
|
}
|
|
data := FooterChromeData{
|
|
MenuName: getString(content, "menuName"),
|
|
ShowWebring: show,
|
|
Copyright: getString(content, "copyright"),
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = footerChromeComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// FooterChromeData is the typed shape for the templ component.
|
|
type FooterChromeData struct {
|
|
MenuName string
|
|
ShowWebring bool
|
|
Copyright string
|
|
}
|