themes-art-deco/reservation.go
Alex Dunmow 9fbedf5ba1 initial: theme plugin art-deco
Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously
an unversioned directory inside ~/src/blockninja-themes/art-deco.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 14:11:19 +08:00

38 lines
1023 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"bytes"
"context"
"git.dev.alexdunmow.com/block/core/blocks"
)
// ReservationBlockMeta defines the reservation strip block.
var ReservationBlockMeta = blocks.BlockMeta{
Key: "reservation",
Title: "Reservation Strip",
Description: "Sticky gold-on-black reservation strip with phone, OpenTable CTA and trading hours.",
Source: "art-deco",
}
// ReservationData is the typed view used by the templ component.
type ReservationData struct {
Phone string
OpenTable string
Hours []string
}
// ReservationBlock renders a reservation strip.
// Content: {"phone": "...", "openTable": "...", "hours": ["TueSat · 6pmlate", ...]}
func ReservationBlock(ctx context.Context, content map[string]any) string {
data := ReservationData{
Phone: getString(content, "phone"),
OpenTable: getString(content, "openTable"),
Hours: getStringSlice(content, "hours"),
}
var buf bytes.Buffer
_ = reservationComponent(data).Render(ctx, &buf)
return buf.String()
}