Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/brutalist. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// MetaStripBlockMeta defines the Metadata Strip block.
|
|
var MetaStripBlockMeta = blocks.BlockMeta{
|
|
Key: "meta_strip",
|
|
Title: "Metadata Strip",
|
|
Description: "Mono uppercase strip: CLIENT / YEAR / DISCIPLINE / LOCATION",
|
|
Category: blocks.CategoryContent,
|
|
Source: "brutalist",
|
|
}
|
|
|
|
// MetaStripItem is one label/value pair in the metadata strip.
|
|
type MetaStripItem struct {
|
|
Label string
|
|
Value string
|
|
}
|
|
|
|
// MetaStripData carries data for the metadata strip component.
|
|
type MetaStripData struct {
|
|
Items []MetaStripItem
|
|
}
|
|
|
|
// MetaStripBlock renders the metadata strip.
|
|
// Content: {"items": [{"label":"CLIENT","value":"..."}, ...]}
|
|
func MetaStripBlock(ctx context.Context, content map[string]any) string {
|
|
raw := getSlice(content, "items")
|
|
items := make([]MetaStripItem, 0, len(raw))
|
|
for _, item := range raw {
|
|
items = append(items, MetaStripItem{
|
|
Label: getString(item, "label"),
|
|
Value: getString(item, "value"),
|
|
})
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = metaStripComponent(MetaStripData{Items: items}).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|