themes-earthen/button_override.go
Alex Dunmow 49401f1b41 initial: theme plugin earthen
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/earthen.

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

28 lines
670 B
Go

package main
import (
"bytes"
"context"
)
// EarthenButtonBlock renders a button with Earthen styling.
// Content expects: {"label": "...", "url": "...", "variant": "primary|secondary|ghost|destructive"}
func EarthenButtonBlock(ctx context.Context, content map[string]any) string {
label := getString(content, "label")
if label == "" {
label = getString(content, "text")
}
url := getString(content, "url")
if url == "" {
url = getString(content, "href")
}
variant := getString(content, "variant")
if variant == "" {
variant = "primary"
}
var buf bytes.Buffer
_ = earthenButtonComponent(label, url, variant).Render(ctx, &buf)
return buf.String()
}