Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/noir. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
49 lines
1.2 KiB
Go
49 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FooterBlockMeta defines the Noir dissolved-rail footer block.
|
|
var FooterBlockMeta = blocks.BlockMeta{
|
|
Key: "footer",
|
|
Title: "Noir Footer",
|
|
Description: "Dissolved bottom rail with optional colophon and social links.",
|
|
Source: "noir",
|
|
Category: blocks.CategoryLayout,
|
|
}
|
|
|
|
// FooterBlock renders the Noir footer.
|
|
// Content shape: {"showColophon":"true","social":[{"text":"Instagram","url":"..."}, ...]}
|
|
func FooterBlock(ctx context.Context, content map[string]any) string {
|
|
data := FooterData{
|
|
ShowColophon: getBoolish(content, "showColophon", true),
|
|
}
|
|
|
|
for _, item := range getSlice(content, "social") {
|
|
data.Social = append(data.Social, FooterLink{
|
|
Text: getString(item, "text"),
|
|
URL: getString(item, "url"),
|
|
})
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = footerComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// FooterData holds the parsed view-model for the Noir footer.
|
|
type FooterData struct {
|
|
ShowColophon bool
|
|
Social []FooterLink
|
|
}
|
|
|
|
// FooterLink is a single social-link entry.
|
|
type FooterLink struct {
|
|
Text string
|
|
URL string
|
|
}
|