import type { CSSProperties, ReactNode } from "react"; import { BaseLayout } from "../_layout/BaseLayout.js"; import { Button } from "../_layout/Button.js"; import { Eyebrow } from "../_layout/Eyebrow.js"; import type { MailBrand } from "../_layout/theme.js"; import type { MailFooterCopy, MailLanguage } from "../_layout/Footer.js"; export interface TransactionalChromeProps { readonly language?: MailLanguage; readonly footerCopy?: MailFooterCopy; } /** * Shared visual scaffold for all transactional templates. * * Every transactional email follows the same shape: eyebrow → headline → * intro paragraph → CTA → optional outro paragraph → support sign-off. * Concentrating that into one component keeps per-template files small * and ensures brand-theme application is uniform. */ export interface TransactionalScaffoldProps extends TransactionalChromeProps { readonly brand: MailBrand; readonly subject: string; readonly previewText?: string; readonly eyebrow: string; readonly title: string; readonly intro: ReactNode; readonly actionUrl?: string; readonly actionLabel?: string; readonly outro?: ReactNode; readonly children?: ReactNode; readonly unsubscribeUrl?: string; readonly signoffThanks?: string; } const titleStyle = (brand: MailBrand): CSSProperties => ({ margin: "8px 0 18px", fontSize: "30px", lineHeight: 1.16, color: brand.textColor, fontWeight: 700, }); const paragraphStyle = (brand: MailBrand): CSSProperties => ({ margin: "0 0 24px", fontSize: "16px", lineHeight: 1.6, color: brand.textColor, }); const outroStyle = (brand: MailBrand): CSSProperties => ({ margin: "30px 0 0", fontSize: "15px", lineHeight: 1.6, color: brand.mutedTextColor, }); const signoffStyle = (brand: MailBrand): CSSProperties => ({ margin: "24px 0 0", fontSize: "14px", lineHeight: 1.6, color: brand.textColor, }); export function TransactionalScaffold({ brand, subject, previewText, eyebrow, title, intro, actionUrl, actionLabel, outro, children, unsubscribeUrl, signoffThanks, language, footerCopy, }: TransactionalScaffoldProps) { return ( {eyebrow}

{title}

{intro}

{actionUrl && actionLabel ? ( ) : null} {outro ?

{outro}

: null} {children}

{footerCopy?.signoffClosing ?? signoffThanks ?? "Kind regards,"}
{footerCopy?.signoffTeam ?? brand.supportFromName}

); }