themes-noir/caption_strip.go
Alex Dunmow 1bebbea5ad initial: theme plugin noir
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/noir.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:40 +08:00

37 lines
937 B
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// CaptionStripBlockMeta defines the Noir caption strip block.
var CaptionStripBlockMeta = blocks.BlockMeta{
Key: "caption_strip",
Title: "Caption Strip",
Description: "Full-width 10px mono caption strip with a label on the left and supporting text on the right.",
Source: "noir",
Category: blocks.CategoryNavigation,
}
// CaptionStripBlock renders a thin caption strip.
// Content shape: {"label":"INDEX","right":"© Studio"}
func CaptionStripBlock(ctx context.Context, content map[string]any) string {
data := CaptionStripData{
Label: getString(content, "label"),
Right: getString(content, "right"),
}
var buf bytes.Buffer
_ = captionStripComponent(data).Render(ctx, &buf)
return buf.String()
}
// CaptionStripData holds the parsed view-model.
type CaptionStripData struct {
Label string
Right string
}