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>
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// StatsGlowMeta defines metadata for the cyberpunk:stats_glow block.
|
|
var StatsGlowMeta = blocks.BlockMeta{
|
|
Key: "stats_glow",
|
|
Title: "Glow Stats",
|
|
Description: "Big mono numerals with neon accent underline",
|
|
Category: "display",
|
|
Source: "cyberpunk",
|
|
}
|
|
|
|
// StatGlowItem is one stat in the grid.
|
|
type StatGlowItem struct {
|
|
Value string
|
|
Label string
|
|
Suffix string
|
|
}
|
|
|
|
// StatsGlowBlock renders the stats_glow block.
|
|
//
|
|
// Content shape:
|
|
// {items:[{value, label, suffix}]}
|
|
func StatsGlowBlock(ctx context.Context, content map[string]any) string {
|
|
raw := getSlice(content, "items")
|
|
items := make([]StatGlowItem, 0, len(raw))
|
|
for _, item := range raw {
|
|
items = append(items, StatGlowItem{
|
|
Value: getString(item, "value"),
|
|
Label: getString(item, "label"),
|
|
Suffix: getString(item, "suffix"),
|
|
})
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = statsGlowComponent(items).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|