themes-art-deco/press_quote.go
Alex Dunmow 9fbedf5ba1 initial: theme plugin art-deco
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/art-deco.

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

40 lines
986 B
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// PressQuoteBlockMeta defines the press quote block.
var PressQuoteBlockMeta = blocks.BlockMeta{
Key: "press_quote",
Title: "Press Quote",
Description: "Italic Cormorant pull-quote between fan dividers, optional star rating.",
Source: "art-deco",
}
// PressQuoteData is the typed view for the press quote component.
type PressQuoteData struct {
Quote string
Source string
Stars int
}
// PressQuoteBlock renders the italic pull-quote framed by fan dividers.
// Content: {"quote": "...", "source": "...", "stars": 5}
func PressQuoteBlock(ctx context.Context, content map[string]any) string {
stars := clampInt(getInt(content, "stars", 0), 0, 5)
data := PressQuoteData{
Quote: getString(content, "quote"),
Source: getString(content, "source"),
Stars: stars,
}
var buf bytes.Buffer
_ = pressQuoteComponent(data).Render(ctx, &buf)
return buf.String()
}