themes-pastel-dream/feature_grid_soft.go
Alex Dunmow de55bbebd6 initial: theme plugin pastel-dream
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/pastel-dream.

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

54 lines
1.3 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// FeatureGridSoftMeta defines the three-up soft feature grid.
var FeatureGridSoftMeta = blocks.BlockMeta{
Key: "feature-grid-soft",
Title: "Feature Trio",
Description: "Three-up card grid for services, offerings, or core values.",
Source: "pastel-dream",
Category: blocks.CategoryLayout,
}
// FeatureGridSoftBlock renders the feature grid.
// Content shape: {intro, items: [{icon, title, body}]}
func FeatureGridSoftBlock(ctx context.Context, content map[string]any) string {
rawItems := getSlice(content, "items")
items := make([]FeatureSoftItem, 0, len(rawItems))
for _, it := range rawItems {
items = append(items, FeatureSoftItem{
Icon: getString(it, "icon"),
Title: getString(it, "title"),
Body: getString(it, "body"),
})
}
data := FeatureGridSoftData{
Intro: getString(content, "intro"),
Items: items,
}
var buf bytes.Buffer
_ = featureGridSoftComponent(data).Render(ctx, &buf)
return buf.String()
}
// FeatureGridSoftData is the rendered view of the feature-grid-soft block.
type FeatureGridSoftData struct {
Intro string
Items []FeatureSoftItem
}
// FeatureSoftItem is a single card in the trio.
type FeatureSoftItem struct {
Icon string
Title string
Body string
}