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

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

26 lines
660 B
Go

package main
import (
"bytes"
"context"
)
// EditorialButtonBlock overrides the built-in `button` block for the
// editorial template. The editorial button is hairline-only: 1px border,
// transparent fill, oxblood text on hover (see .editorial-button CSS).
//
// Content shape: { "text", "url", "ariaLabel" }.
func EditorialButtonBlock(ctx context.Context, content map[string]any) string {
text := getString(content, "text")
url := getString(content, "url")
ariaLabel := getString(content, "ariaLabel")
if text == "" {
return ""
}
var buf bytes.Buffer
_ = editorialButtonComponent(text, url, ariaLabel).Render(ctx, &buf)
return buf.String()
}