Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/coffee. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
33 lines
865 B
Go
33 lines
865 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// DoodleDividerBlockMeta defines metadata for the doodle_divider block.
|
|
var DoodleDividerBlockMeta = blocks.BlockMeta{
|
|
Key: "doodle_divider",
|
|
Title: "Doodle Divider",
|
|
Description: "Hand-drawn divider in one of four motifs (beans, croissant, cup, leaf)",
|
|
Source: "coffee",
|
|
}
|
|
|
|
// DoodleDividerBlock renders an inline SVG divider based on the motif.
|
|
// Content shape: {"motif": "beans"} where motif is one of beans/croissant/cup/leaf.
|
|
func DoodleDividerBlock(ctx context.Context, content map[string]any) string {
|
|
motif := getString(content, "motif")
|
|
switch motif {
|
|
case "beans", "croissant", "cup", "leaf":
|
|
// allowed
|
|
default:
|
|
motif = "beans"
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = doodleDividerComponent(motif).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|