Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/magazine-bold. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// CoverStoryBlockMeta is the 12-column asymmetric hero anchoring the issue landing.
|
|
var CoverStoryBlockMeta = blocks.BlockMeta{
|
|
Key: "cover_story",
|
|
Title: "Cover Story",
|
|
Description: "12-column asymmetric hero with kicker, oversized display headline, deck and cover image.",
|
|
Source: "magazine-bold",
|
|
Category: blocks.CategoryContent,
|
|
}
|
|
|
|
// CoverStoryData is what the templ component consumes.
|
|
type CoverStoryData struct {
|
|
Kicker string
|
|
Headline string
|
|
Deck string
|
|
Image string
|
|
Link string
|
|
}
|
|
|
|
// CoverStoryBlock renders the cover-story hero.
|
|
// content keys: kicker, headline (richtext), deck (richtext), image (media), link.
|
|
func CoverStoryBlock(ctx context.Context, content map[string]any) string {
|
|
data := CoverStoryData{
|
|
Kicker: getString(content, "kicker"),
|
|
Headline: getString(content, "headline"),
|
|
Deck: getString(content, "deck"),
|
|
Image: blocks.ResolveMediaPath(getString(content, "image")),
|
|
Link: getString(content, "link"),
|
|
}
|
|
var buf bytes.Buffer
|
|
_ = coverStoryComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|