themes-kindergarten/mascot_hero.go
Alex Dunmow ffe46a146c initial: theme plugin kindergarten
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/kindergarten.

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

45 lines
1.2 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// MascotHeroBlockMeta defines metadata for the mascot hero block.
var MascotHeroBlockMeta = blocks.BlockMeta{
Key: "mascot_hero",
Title: "Mascot Hero",
Description: "Big rounded panel with mascot SVG and primary-colored confetti.",
Category: blocks.CategoryContent,
Source: "kindergarten",
}
// MascotHeroData carries the strongly-typed shape consumed by the templ component.
type MascotHeroData struct {
Mascot string
Headline string
Tagline string
CTALabel string
CTAHref string
BgColor string
}
// MascotHeroBlock renders the mascot hero block from the unstructured content map.
// Content shape: {mascot,headline,tagline,ctaLabel,ctaHref,bgColor}.
func MascotHeroBlock(ctx context.Context, content map[string]any) string {
data := MascotHeroData{
Mascot: getStringDefault(content, "mascot", "pip"),
Headline: getString(content, "headline"),
Tagline: getString(content, "tagline"),
CTALabel: getString(content, "ctaLabel"),
CTAHref: getString(content, "ctaHref"),
BgColor: getString(content, "bgColor"),
}
var buf bytes.Buffer
_ = mascotHeroComponent(data).Render(ctx, &buf)
return buf.String()
}