Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/earthen. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
44 lines
1020 B
Go
44 lines
1020 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// BotanicalDividerBlockMeta defines metadata for the botanical divider block.
|
|
var BotanicalDividerBlockMeta = blocks.BlockMeta{
|
|
Key: "botanical_divider",
|
|
Title: "Botanical Divider",
|
|
Description: "Hand-illustrated SVG section break",
|
|
Source: "earthen",
|
|
Category: blocks.CategoryLayout,
|
|
}
|
|
|
|
// BotanicalDividerBlock renders the botanical divider block.
|
|
// Content shape: {motif:"fern"|"root"|"seed"}
|
|
func BotanicalDividerBlock(ctx context.Context, content map[string]any) string {
|
|
motif := getString(content, "motif")
|
|
switch motif {
|
|
case "fern", "root", "seed":
|
|
default:
|
|
motif = "fern"
|
|
}
|
|
|
|
data := BotanicalDividerData{
|
|
Motif: motif,
|
|
Empty: len(content) == 0,
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = botanicalDividerComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// BotanicalDividerData contains data for the divider component.
|
|
type BotanicalDividerData struct {
|
|
Motif string
|
|
Empty bool
|
|
}
|