Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/y2k. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// MetaballHeroBlockMeta declares the metaball hero block.
|
|
var MetaballHeroBlockMeta = blocks.BlockMeta{
|
|
Key: "metaball_hero",
|
|
Title: "Metaball Hero",
|
|
Description: "SVG metaballs on a gradient mesh canvas with headline + CTA.",
|
|
Source: "y2k",
|
|
Category: blocks.CategoryLayout,
|
|
}
|
|
|
|
// MetaballHeroBlock renders the metaball hero.
|
|
// Content: {headline, sub, ctaLabel, ctaHref, bgPreset}
|
|
func MetaballHeroBlock(ctx context.Context, content map[string]any) string {
|
|
data := MetaballHeroData{
|
|
Headline: getString(content, "headline"),
|
|
Sub: getString(content, "sub"),
|
|
CTALabel: getString(content, "ctaLabel"),
|
|
CTAHref: getString(content, "ctaHref"),
|
|
BgPreset: getStringOr(content, "bgPreset", "magenta-teal"),
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = metaballHeroComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// MetaballHeroData is the typed shape for the templ component.
|
|
type MetaballHeroData struct {
|
|
Headline string
|
|
Sub string
|
|
CTALabel string
|
|
CTAHref string
|
|
BgPreset string
|
|
}
|