themes-kindergarten/big_cta.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

46 lines
1.0 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// BigCTABlockMeta defines metadata for the oversized CTA block.
var BigCTABlockMeta = blocks.BlockMeta{
Key: "big_cta",
Title: "Big CTA",
Description: "Oversized pill button with crayon underline.",
Category: blocks.CategoryContent,
Source: "kindergarten",
}
// BigCTAData is the renderer input.
type BigCTAData struct {
Label string
Href string
ColorVariant string
}
// BigCTABlock renders the oversized pill button.
// Content shape: {label,href,colorVariant}.
func BigCTABlock(ctx context.Context, content map[string]any) string {
color := getStringDefault(content, "colorVariant", "yellow")
switch color {
case "red", "blue", "yellow", "green":
default:
color = "yellow"
}
data := BigCTAData{
Label: getString(content, "label"),
Href: getStringDefault(content, "href", "#"),
ColorVariant: color,
}
var buf bytes.Buffer
_ = bigCTAComponent(data).Render(ctx, &buf)
return buf.String()
}