themes-kindergarten/storybook_quote.go
Alex Dunmow ffe46a146c initial: theme plugin kindergarten
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/kindergarten.

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

39 lines
1.0 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// StorybookQuoteBlockMeta defines metadata for the storybook quote block.
var StorybookQuoteBlockMeta = blocks.BlockMeta{
Key: "storybook_quote",
Title: "Storybook Quote",
Description: "Picture-book page treatment for a quote with optional illustration.",
Category: blocks.CategoryContent,
Source: "kindergarten",
}
// StorybookQuoteData is the renderer input.
type StorybookQuoteData struct {
Quote string
Author string
Illustration string
}
// StorybookQuoteBlock renders the quote panel.
// Content shape: {quote,author,illustration}.
func StorybookQuoteBlock(ctx context.Context, content map[string]any) string {
data := StorybookQuoteData{
Quote: getString(content, "quote"),
Author: getString(content, "author"),
Illustration: getString(content, "illustration"),
}
var buf bytes.Buffer
_ = storybookQuoteComponent(data).Render(ctx, &buf)
return buf.String()
}