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>
38 lines
1023 B
Go
38 lines
1023 B
Go
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": ["Tue–Sat · 6pm–late", ...]}
|
||
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()
|
||
}
|