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>
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FeatureCardNeonMeta defines metadata for the cyberpunk:feature_card_neon block.
|
|
var FeatureCardNeonMeta = blocks.BlockMeta{
|
|
Key: "feature_card_neon",
|
|
Title: "Neon Feature Card",
|
|
Description: "Single feature card with per-card neon edge glow (magenta/cyan/lime)",
|
|
Category: blocks.CategoryLayout,
|
|
Source: "cyberpunk",
|
|
}
|
|
|
|
// FeatureCardNeonData is the typed view of the feature_card_neon content map.
|
|
type FeatureCardNeonData struct {
|
|
Icon string
|
|
Title string
|
|
Body string
|
|
Accent string
|
|
}
|
|
|
|
// FeatureCardNeonBlock renders the feature_card_neon block.
|
|
//
|
|
// Content shape:
|
|
// {icon, title, body, accent:"magenta"|"cyan"|"lime"}
|
|
func FeatureCardNeonBlock(ctx context.Context, content map[string]any) string {
|
|
data := FeatureCardNeonData{
|
|
Icon: getString(content, "icon"),
|
|
Title: getStringWithDefault(content, "title", "Feature"),
|
|
Body: getString(content, "body"),
|
|
Accent: parseAccent(getString(content, "accent")),
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = featureCardNeonComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// parseAccent normalises the accent value to one of the three known accents.
|
|
func parseAccent(v string) string {
|
|
switch v {
|
|
case "magenta", "cyan", "lime":
|
|
return v
|
|
default:
|
|
return "magenta"
|
|
}
|
|
}
|