themes-earthen/button_override.templ
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

35 lines
1.1 KiB
Plaintext

package main
// earthenButtonStyle returns inline CSS based on variant.
func earthenButtonStyle(variant string) string {
switch variant {
case "secondary":
return "background-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); border: 1px solid hsl(var(--border));"
case "ghost":
return "background-color: transparent; color: hsl(var(--primary)); border: 1.5px dashed hsl(var(--primary) / 0.6);"
case "destructive":
return "background-color: hsl(var(--destructive)); color: hsl(var(--destructive-foreground));"
default:
return "background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground));"
}
}
// earthenButtonComponent renders a clay-fired button with Earthen styling.
templ earthenButtonComponent(label, url, variant string) {
<a
href={ templ.SafeURL(earthenButtonURL(url)) }
data-variant={ variant }
class="earthen-button inline-flex items-center justify-center px-6 py-3 rounded-lg font-semibold transition-colors focus:outline-none"
style={ earthenButtonStyle(variant) }
>
{ label }
</a>
}
func earthenButtonURL(url string) string {
if url == "" {
return "#"
}
return url
}