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"
|
|
)
|
|
|
|
// 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()
|
|
}
|