package main // merchCardComponent renders a single merch card. The card class is applied // to a grid container managed by the page; this block stays self-contained. templ merchCardComponent(data MerchCardData) {
if data.Sticker != "" { { stickerLabel(data.Sticker) } }
if data.Image != "" { { } else {
no image
}

{ titleOr(data.Title) }

{ priceOr(data.Price) } if data.BuyHref != "" { buy }
} func stickerLabel(s string) string { switch s { case "sold-out": return "sold out" default: return s } } func titleOr(s string) string { if s == "" { return "untitled" } return s } func priceOr(s string) string { if s == "" { return "$--" } return s }