package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // FooterBlockMeta defines metadata for the instrument footer block. var FooterBlockMeta = blocks.BlockMeta{ Key: "footer", Title: "Instrument Footer", Description: "Hairline-rule footer with callsign, optional signup, and link list.", Source: "scifi-clean", Category: blocks.CategoryLayout, } // FooterLink is one footer link entry. type FooterLink struct { Text string URL string } // FooterData drives the templ render. type FooterData struct { ShowSignup bool Callsign string Links []FooterLink } // FooterBlock renders the footer. // Content shape: {"showSignup": false, "callsign": "SCF-CLN", "links": [{"text": "...", "url": "..."}]} func FooterBlock(ctx context.Context, content map[string]any) string { data := FooterData{ ShowSignup: getBool(content, "showSignup", false), Callsign: getStringDefault(content, "callsign", "SCF-CLN"), } for _, raw := range getSlice(content, "links") { data.Links = append(data.Links, FooterLink{ Text: getString(raw, "text"), URL: getString(raw, "url"), }) } var buf bytes.Buffer _ = footerComponent(data).Render(ctx, &buf) return buf.String() } // safeHref returns # for blank URLs so the templ.SafeURL helper has something to chew on. func safeHref(u string) string { if u == "" { return "#" } return u }