themes-brutalist/masthead.go
Alex Dunmow 771a286fa9 initial: theme plugin brutalist
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>
2026-06-06 14:11:21 +08:00

45 lines
1.1 KiB
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// MastheadBlockMeta defines the Studio Masthead block.
var MastheadBlockMeta = blocks.BlockMeta{
Key: "masthead",
Title: "Studio Masthead",
Description: "Oversized studio wordmark with mono index counter top-right",
Category: blocks.CategoryLayout,
Source: "brutalist",
}
// MastheadData carries display data for the masthead component.
type MastheadData struct {
StudioName string
Tagline string
IndexNumber string
}
// MastheadBlock renders the studio masthead.
// Content: {"studioName": "...", "tagline": "...", "indexNumber": "01 / 14"}
func MastheadBlock(ctx context.Context, content map[string]any) string {
data := MastheadData{
StudioName: getString(content, "studioName"),
Tagline: getString(content, "tagline"),
IndexNumber: getString(content, "indexNumber"),
}
if data.StudioName == "" {
data.StudioName = "STUDIO"
}
if data.IndexNumber == "" {
data.IndexNumber = "01 / 14"
}
var buf bytes.Buffer
_ = mastheadComponent(data).Render(ctx, &buf)
return buf.String()
}