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

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

32 lines
793 B
Go

package main
import (
"bytes"
"context"
)
// CorporateModernistButtonBlock renders the built-in `button` block with
// squared 4px corners, accent fill or 1px outline only — no shadow, no
// gradient. Content shape: {"label":"...", "href":"...", "variant":"primary|outline"}.
func CorporateModernistButtonBlock(ctx context.Context, content map[string]any) string {
label := getString(content, "label")
if label == "" {
label = getString(content, "text")
}
href := getString(content, "href")
if href == "" {
href = getString(content, "url")
}
if href == "" {
href = "#"
}
variant := getString(content, "variant")
if variant == "" {
variant = "primary"
}
var buf bytes.Buffer
_ = buttonOverrideComponent(label, href, variant).Render(ctx, &buf)
return buf.String()
}