themes-magazine-bold/pull_quote.go
Alex Dunmow fe754f634b initial: theme plugin magazine-bold
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/magazine-bold.

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

38 lines
1020 B
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// PullQuoteBlockMeta is the color-block pull quote.
var PullQuoteBlockMeta = blocks.BlockMeta{
Key: "pull_quote",
Title: "Pull Quote",
Description: "Color-block pull quote with rotating accent (pink / blue / lime).",
Source: "magazine-bold",
Category: blocks.CategoryContent,
}
// PullQuoteData is what the templ component consumes.
type PullQuoteData struct {
Quote string
Attribution string
Accent string
}
// PullQuoteBlock renders the color-block pull quote.
// content keys: quote (richtext), attribution (text), accent (select).
func PullQuoteBlock(ctx context.Context, content map[string]any) string {
data := PullQuoteData{
Quote: getString(content, "quote"),
Attribution: getString(content, "attribution"),
Accent: normalizeAccent(getString(content, "accent")),
}
var buf bytes.Buffer
_ = pullQuoteComponent(data).Render(ctx, &buf)
return buf.String()
}