Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/coffee. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FeaturedPourBlockMeta defines metadata for the featured_pour block.
|
|
var FeaturedPourBlockMeta = blocks.BlockMeta{
|
|
Key: "featured_pour",
|
|
Title: "Featured Pour",
|
|
Description: "Hero card for a featured coffee, tea or pastry with tasting notes and price",
|
|
Source: "coffee",
|
|
}
|
|
|
|
// FeaturedPourBlock renders a featured pour card.
|
|
// Content shape: {"name": "...", "tasting": "...rich text...", "image": "...", "price": "..."}
|
|
func FeaturedPourBlock(ctx context.Context, content map[string]any) string {
|
|
data := FeaturedPourData{
|
|
Name: getString(content, "name"),
|
|
Tasting: getString(content, "tasting"),
|
|
Image: getString(content, "image"),
|
|
Price: getString(content, "price"),
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = featuredPourComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// FeaturedPourData holds the data for the component.
|
|
type FeaturedPourData struct {
|
|
Name string
|
|
Tasting string
|
|
Image string
|
|
Price string
|
|
}
|