Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/brutalist. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// ConcreteHeroBlockMeta defines the Concrete Hero block.
|
|
var ConcreteHeroBlockMeta = blocks.BlockMeta{
|
|
Key: "concrete_hero",
|
|
Title: "Concrete Hero",
|
|
Description: "200pt+ display headline with optional eyebrow and full-bleed image",
|
|
Category: blocks.CategoryLayout,
|
|
Source: "brutalist",
|
|
}
|
|
|
|
// ConcreteHeroData carries data for the concrete hero component.
|
|
type ConcreteHeroData struct {
|
|
Headline string
|
|
Eyebrow string
|
|
MediaURL string
|
|
}
|
|
|
|
// ConcreteHeroBlock renders the concrete hero.
|
|
// Content: {"headline": "...", "eyebrow": "...", "media": "media:<id>"}
|
|
func ConcreteHeroBlock(ctx context.Context, content map[string]any) string {
|
|
media := getString(content, "media")
|
|
resolvedMedia := ""
|
|
if media != "" {
|
|
resolvedMedia = blocks.ResolveMediaPath(media)
|
|
}
|
|
|
|
data := ConcreteHeroData{
|
|
Headline: getString(content, "headline"),
|
|
Eyebrow: getString(content, "eyebrow"),
|
|
MediaURL: resolvedMedia,
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = concreteHeroComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|