package main
import (
"bytes"
"context"
"fmt"
"git.dev.alexdunmow.com/block/core/templates"
)
// GothamEmailWrapper wraps body content in a dark, modern Gotham-branded email template.
func GothamEmailWrapper(body string, emailCtx templates.EmailContext) string {
var buf bytes.Buffer
gothamEmailTemplate(emailCtx, body).Render(context.Background(), &buf)
return buf.String()
}
// gothamEmailTemplate is the Gotham-branded email template component.
templ gothamEmailTemplate(emailCtx templates.EmailContext, body string) {
{ emailCtx.SiteSettings.SiteName }
if emailCtx.PreviewText != "" {
{ emailCtx.PreviewText }
}
if emailCtx.SiteSettings.LogoURL != "" {
} else if emailCtx.SiteSettings.SiteName != "" {
{ emailCtx.SiteSettings.SiteName }
}
|
|
@templ.Raw(body)
|
|
|
|
}
// Gotham color helper functions - return hex colors with dark theme defaults
func gothamBgColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Background != "" {
return emailCtx.Colors.Background
}
return "#0a0a0a" // Near black
}
func gothamCardColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Card != "" {
return emailCtx.Colors.Card
}
return "#141414" // Dark card
}
func gothamFgColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Foreground != "" {
return emailCtx.Colors.Foreground
}
return "#fafafa" // Near white
}
func gothamPrimaryColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Primary != "" {
return emailCtx.Colors.Primary
}
return "#fafafa" // Gotham uses white as primary
}
func gothamMutedFgColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.MutedForeground != "" {
return emailCtx.Colors.MutedForeground
}
return "#737373" // Gray
}
func gothamMutedColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Muted != "" {
return emailCtx.Colors.Muted
}
return "#1a1a1a" // Darker muted
}
func gothamBorderColor(emailCtx templates.EmailContext) string {
if emailCtx.Colors.Border != "" {
return emailCtx.Colors.Border
}
return "#262626" // Dark border
}