Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/cyberpunk. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
63 lines
1.5 KiB
Go
63 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FooterGridMeta defines metadata for the cyberpunk:footer_grid block.
|
|
var FooterGridMeta = blocks.BlockMeta{
|
|
Key: "footer_grid",
|
|
Title: "Grid Footer",
|
|
Description: "Mono columns, build-hash + uptime status pill",
|
|
Category: blocks.CategoryNavigation,
|
|
Source: "cyberpunk",
|
|
}
|
|
|
|
// FooterColumn is one column of footer links.
|
|
type FooterColumn struct {
|
|
Title string
|
|
Links []Link
|
|
}
|
|
|
|
// FooterGridData is the typed view of the footer_grid content map.
|
|
type FooterGridData struct {
|
|
ShowStatus bool
|
|
BuildHash string
|
|
Columns []FooterColumn
|
|
}
|
|
|
|
// FooterGridBlock renders the footer_grid block.
|
|
//
|
|
// Content shape:
|
|
// {showStatus, buildHash, columns:[{title, links:[{label, href}]}]}
|
|
func FooterGridBlock(ctx context.Context, content map[string]any) string {
|
|
cols := getSlice(content, "columns")
|
|
columns := make([]FooterColumn, 0, len(cols))
|
|
for _, col := range cols {
|
|
linkObjs := getSlice(col, "links")
|
|
links := make([]Link, 0, len(linkObjs))
|
|
for _, l := range linkObjs {
|
|
links = append(links, Link{
|
|
Label: getString(l, "label"),
|
|
Href: getString(l, "href"),
|
|
})
|
|
}
|
|
columns = append(columns, FooterColumn{
|
|
Title: getString(col, "title"),
|
|
Links: links,
|
|
})
|
|
}
|
|
|
|
data := FooterGridData{
|
|
ShowStatus: getBool(content, "showStatus", true),
|
|
BuildHash: getStringWithDefault(content, "buildHash", "dev"),
|
|
Columns: columns,
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = footerGridComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|