package main import ( "bytes" "context" "time" "git.dev.alexdunmow.com/block/core/blocks" ) // ColophonBlockMeta defines the Colophon Footer block. var ColophonBlockMeta = blocks.BlockMeta{ Key: "colophon", Title: "Colophon Footer", Description: "Three-row mono footer with copyright stamp", Category: blocks.CategoryLayout, Source: "brutalist", } // ColophonSocialLink represents a single social link. type ColophonSocialLink struct { Label string URL string } // ColophonData carries data for the colophon component. type ColophonData struct { Address string Email string ShowAddress bool Social []ColophonSocialLink Year string } // ColophonBlock renders the colophon footer. // Content: {"address": "...", "email": "...", "showAddress": "true", "social": [{"label":"...","url":"..."}]} func ColophonBlock(ctx context.Context, content map[string]any) string { raw := getSlice(content, "social") social := make([]ColophonSocialLink, 0, len(raw)) for _, item := range raw { social = append(social, ColophonSocialLink{ Label: getString(item, "label"), URL: getString(item, "url"), }) } data := ColophonData{ Address: getString(content, "address"), Email: getString(content, "email"), ShowAddress: getBool(content, "showAddress", true), Social: social, Year: time.Now().UTC().Format("2006"), } var buf bytes.Buffer _ = colophonComponent(data).Render(ctx, &buf) return buf.String() }