Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/kindergarten. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FooterBlockMeta defines metadata for the friendly footer block.
|
|
var FooterBlockMeta = blocks.BlockMeta{
|
|
Key: "footer",
|
|
Title: "Friendly Footer",
|
|
Description: "Mascot wave, signup, contact, crayon-rule divider.",
|
|
Category: blocks.CategoryLayout,
|
|
Source: "kindergarten",
|
|
}
|
|
|
|
// FooterSocial is a single social link entry.
|
|
type FooterSocial struct {
|
|
Platform string
|
|
Href string
|
|
}
|
|
|
|
// FooterData is the renderer input.
|
|
type FooterData struct {
|
|
ShowSignup bool
|
|
MascotName string
|
|
SocialLinks []FooterSocial
|
|
}
|
|
|
|
// FooterBlock renders the friendly footer.
|
|
// Content shape: {showSignup,mascotName,socialLinks}.
|
|
func FooterBlock(ctx context.Context, content map[string]any) string {
|
|
raw := getSlice(content, "socialLinks")
|
|
links := make([]FooterSocial, 0, len(raw))
|
|
for _, m := range raw {
|
|
links = append(links, FooterSocial{
|
|
Platform: getString(m, "platform"),
|
|
Href: getString(m, "href"),
|
|
})
|
|
}
|
|
|
|
data := FooterData{
|
|
ShowSignup: getBool(content, "showSignup", true),
|
|
MascotName: getStringDefault(content, "mascotName", "Pip"),
|
|
SocialLinks: links,
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = footerComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|