themes-pastel-dream/watercolor_hero.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

45 lines
1.2 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// WatercolorHeroMeta defines metadata for the watercolor hero.
var WatercolorHeroMeta = blocks.BlockMeta{
Key: "watercolor-hero",
Title: "Watercolor Hero",
Description: "Hero with two-tone watercolor blobs layered behind soft display type.",
Source: "pastel-dream",
Category: blocks.CategoryTheme,
}
// WatercolorHeroBlock renders the hero section.
// Content shape: {eyebrow, headline, body, image, ctaText, ctaHref}
func WatercolorHeroBlock(ctx context.Context, content map[string]any) string {
data := WatercolorHeroData{
Eyebrow: getString(content, "eyebrow"),
Headline: getStringOr(content, "headline", "Soft starts"),
Body: getString(content, "body"),
Image: getString(content, "image"),
CTAText: getString(content, "ctaText"),
CTAHref: safeLink(getString(content, "ctaHref")),
}
var buf bytes.Buffer
_ = watercolorHeroComponent(data).Render(ctx, &buf)
return buf.String()
}
// WatercolorHeroData is the rendered view of the watercolor-hero block.
type WatercolorHeroData struct {
Eyebrow string
Headline string
Body string
Image string
CTAText string
CTAHref string
}