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>
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// DividerFanBlockMeta defines the fan divider block.
|
|
var DividerFanBlockMeta = blocks.BlockMeta{
|
|
Key: "divider_fan",
|
|
Title: "Fan Divider",
|
|
Description: "Pure-CSS gold geometric divider — sunburst, scallop or ziggurat.",
|
|
Source: "art-deco",
|
|
}
|
|
|
|
// DividerFanData carries the variant for the divider component.
|
|
type DividerFanData struct {
|
|
Variant string
|
|
}
|
|
|
|
// normaliseVariant clamps to the supported set; unknown values fall back to sunburst.
|
|
func normaliseVariant(v string) string {
|
|
switch v {
|
|
case "scallop", "ziggurat":
|
|
return v
|
|
default:
|
|
return "sunburst"
|
|
}
|
|
}
|
|
|
|
// DividerFanBlock renders a CSS-only geometric divider.
|
|
// Content: {"variant": "sunburst" | "scallop" | "ziggurat"}
|
|
func DividerFanBlock(ctx context.Context, content map[string]any) string {
|
|
data := DividerFanData{
|
|
Variant: normaliseVariant(getString(content, "variant")),
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = dividerFanComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|