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>
32 lines
872 B
Go
32 lines
872 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
)
|
|
|
|
// KindergartenButtonBlock renders a pill (border-radius 9999px) button with
|
|
// the sticker drop-shadow effect from spec §9.
|
|
//
|
|
// Content shape (matches built-in button): {"text": "...", "href": "...", "variant": "..."}.
|
|
func KindergartenButtonBlock(ctx context.Context, content map[string]any) string {
|
|
label := getString(content, "text")
|
|
if label == "" {
|
|
// Some installs may store the label under "label" instead.
|
|
label = getString(content, "label")
|
|
}
|
|
href := getStringDefault(content, "href", "#")
|
|
variant := getStringDefault(content, "variant", "yellow")
|
|
switch variant {
|
|
case "red", "blue", "yellow", "green":
|
|
default:
|
|
variant = "yellow"
|
|
}
|
|
|
|
data := BigCTAData{Label: label, Href: href, ColorVariant: variant}
|
|
|
|
var buf bytes.Buffer
|
|
_ = kgButtonComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|