themes-coffee/location_card.go
Alex Dunmow 11c6c8c63e initial: theme plugin coffee
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>
2026-06-06 14:11:22 +08:00

38 lines
1018 B
Go

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// LocationCardBlockMeta defines metadata for the location_card block.
var LocationCardBlockMeta = blocks.BlockMeta{
Key: "location_card",
Title: "Location Card",
Description: "Address card with optional static map image and doodled pin overlay",
Source: "coffee",
}
// LocationCardBlock renders a location card.
// Content shape: {"address": "...", "mapImage": "...", "directionsUrl": "..."}
func LocationCardBlock(ctx context.Context, content map[string]any) string {
data := LocationCardData{
Address: getString(content, "address"),
MapImage: getString(content, "mapImage"),
DirectionsURL: getString(content, "directionsUrl"),
}
var buf bytes.Buffer
_ = locationCardComponent(data).Render(ctx, &buf)
return buf.String()
}
// LocationCardData holds the data the template needs.
type LocationCardData struct {
Address string
MapImage string
DirectionsURL string
}