themes-y2k/webring_badge.go
Alex Dunmow 49f9c90589 initial: theme plugin y2k
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/y2k.

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

38 lines
1008 B
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// WebringBadgeBlockMeta declares the canonical 88x31 webring badge row.
var WebringBadgeBlockMeta = blocks.BlockMeta{
Key: "webring_badge",
Title: "Webring Badge",
Description: "Canonical 88x31 webring button row with prev/next/ring links.",
Source: "y2k",
Category: blocks.CategoryNavigation,
}
// WebringBadgeBlock renders the badge row.
// Content: {prevHref, nextHref, ringName}
func WebringBadgeBlock(ctx context.Context, content map[string]any) string {
data := WebringBadgeData{
PrevHref: getString(content, "prevHref"),
NextHref: getString(content, "nextHref"),
RingName: getStringOr(content, "ringName", "the y2k.fm ring"),
}
var buf bytes.Buffer
_ = webringBadgeComponent(data).Render(ctx, &buf)
return buf.String()
}
// WebringBadgeData is the typed shape for the templ component.
type WebringBadgeData struct {
PrevHref string
NextHref string
RingName string
}