@tonycodes-ui/mortar 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* Transactional email: @tonycodes-ui/mortar/email. Built on React Email,
1
+ /* Email components for @tonycodes-ui/mortar/email. Built on React Email,
2
2
  which renders the table layout and inline styles email clients need; these
3
3
  components give it Mortar's tokens, brand and copy. Nothing here uses
4
4
  Mortar's stylesheet or app components, which email clients cannot run.
@@ -16,6 +16,7 @@ import {
16
16
  Container,
17
17
  Head,
18
18
  Heading,
19
+ Hr,
19
20
  Html,
20
21
  Img,
21
22
  Link,
@@ -23,20 +24,29 @@ import {
23
24
  Text,
24
25
  render,
25
26
  } from "@react-email/components";
27
+ import type { Tone } from "./primitives.js";
26
28
  import { emailTheme, type EmailTheme } from "./email-theme.js";
27
29
 
28
- export { emailTheme } from "./email-theme.js";
29
- export type { EmailTheme } from "./email-theme.js";
30
-
31
- const ThemeContext = createContext<EmailTheme | undefined>(undefined);
30
+ const ShellContext = createContext<
31
+ { theme: EmailTheme; dir: "ltr" | "rtl" } | undefined
32
+ >(undefined);
32
33
  let neutral: EmailTheme | undefined;
33
34
  /** The theme from the enclosing EmailShell, or Mortar's neutral theme. */
34
35
  function useTheme(): EmailTheme {
35
- return useContext(ThemeContext) ?? (neutral ??= emailTheme());
36
+ return useContext(ShellContext)?.theme ?? (neutral ??= emailTheme());
37
+ }
38
+ /* Email clients don't support logical properties, so the inline start and
39
+ end are worked out from the shell's direction. */
40
+ function useSides() {
41
+ const rtl = useContext(ShellContext)?.dir === "rtl";
42
+ return {
43
+ start: rtl ? "right" : "left",
44
+ end: rtl ? "left" : "right",
45
+ } as const;
36
46
  }
37
47
 
38
48
  /* Links leave the mail client, so only web and mail addresses are allowed. */
39
- function assertHref(href: string, component: string, mail = false) {
49
+ export function assertHref(href: string, component: string, mail = false) {
40
50
  if (!(mail ? /^(?:https?:|mailto:)/i : /^https?:\/\//i).test(href.trim()))
41
51
  throw new Error(
42
52
  `Mortar ${component} needs an absolute ${mail ? "http(s) or mailto" : "http(s)"} URL: "${href}"`,
@@ -107,7 +117,7 @@ export function EmailShell({
107
117
  const theme = given ?? emailTheme();
108
118
  if (logo) assertHref(logo.src, "EmailShell logo");
109
119
  return (
110
- <ThemeContext.Provider value={theme}>
120
+ <ShellContext.Provider value={{ theme, dir }}>
111
121
  <Html lang={lang} dir={dir}>
112
122
  <Head>
113
123
  <meta name="color-scheme" content="light" />
@@ -162,7 +172,7 @@ export function EmailShell({
162
172
  </Container>
163
173
  </Body>
164
174
  </Html>
165
- </ThemeContext.Provider>
175
+ </ShellContext.Provider>
166
176
  );
167
177
  }
168
178
 
@@ -270,7 +280,8 @@ export function EmailLink({ href, children }: EmailLinkProps) {
270
280
  style={{
271
281
  color: theme.link,
272
282
  textDecoration: "underline",
273
- wordBreak: "break-all",
283
+ // A bare URL may break anywhere so it can't widen the email.
284
+ wordBreak: children === undefined ? "break-all" : undefined,
274
285
  }}
275
286
  >
276
287
  {children ?? href}
@@ -312,6 +323,180 @@ export function EmailCode({ code }: EmailCodeProps) {
312
323
  );
313
324
  }
314
325
 
326
+ export interface EmailCalloutProps {
327
+ /** Colours the edge: a status, or `neutral` for an aside such as a quoted message. */
328
+ tone?: Tone;
329
+ title?: string;
330
+ children: ReactNode;
331
+ }
332
+ /** A highlighted block: a warning, a status or a quoted personal message. */
333
+ export function EmailCallout({
334
+ tone = "neutral",
335
+ title,
336
+ children,
337
+ }: EmailCalloutProps) {
338
+ const theme = useTheme();
339
+ const { start } = useSides();
340
+ const edge = tone === "neutral" ? theme.line : theme[tone];
341
+ return (
342
+ <Cell style={{ padding: "8px 0 24px" }}>
343
+ <Cell
344
+ style={{
345
+ backgroundColor: theme.sunken,
346
+ [start === "left" ? "borderLeft" : "borderRight"]:
347
+ `4px solid ${edge}`,
348
+ padding: "16px 20px",
349
+ fontFamily: theme.font,
350
+ fontSize: "15px",
351
+ lineHeight: "22px",
352
+ color: theme.ink,
353
+ }}
354
+ >
355
+ {title && (
356
+ <Text
357
+ style={{
358
+ margin: "0 0 4px",
359
+ fontFamily: theme.font,
360
+ fontSize: "15px",
361
+ lineHeight: "22px",
362
+ fontWeight: 600,
363
+ color: theme.ink,
364
+ }}
365
+ >
366
+ {title}
367
+ </Text>
368
+ )}
369
+ {children}
370
+ </Cell>
371
+ </Cell>
372
+ );
373
+ }
374
+
375
+ /** A rule between sections of an email. */
376
+ export function EmailDivider() {
377
+ const theme = useTheme();
378
+ return (
379
+ <Hr
380
+ style={{
381
+ margin: "8px 0 24px",
382
+ border: "none",
383
+ borderTop: `1px solid ${theme.line}`,
384
+ }}
385
+ />
386
+ );
387
+ }
388
+
389
+ export interface EmailSummaryItem {
390
+ name: string;
391
+ /** Preformatted, e.g. "£42.00". */
392
+ price: string;
393
+ quantity?: number;
394
+ /** Chosen options, e.g. "Natural · Small". */
395
+ meta?: string;
396
+ }
397
+ export interface EmailSummaryProps {
398
+ /** Line items, each with its preformatted price. */
399
+ items?: EmailSummaryItem[];
400
+ /** Cost lines under the items, as OrderSummary takes them: subtotal, shipping, tax. */
401
+ lines?: { label: string; value: string }[];
402
+ total: { label: string; value: string };
403
+ }
404
+ /**
405
+ * A receipt's items, cost lines and total, as a two-column table: labels at
406
+ * the start, amounts at the end. Amounts are preformatted strings, as in
407
+ * Mortar's commerce components.
408
+ */
409
+ export function EmailSummary({
410
+ items = [],
411
+ lines = [],
412
+ total,
413
+ }: EmailSummaryProps) {
414
+ const theme = useTheme();
415
+ const { start, end } = useSides();
416
+ const cell = (side: "start" | "end", extra: CSSProperties = {}) => ({
417
+ padding: "8px 0",
418
+ textAlign: side === "start" ? start : end,
419
+ verticalAlign: "top",
420
+ fontFamily: theme.font,
421
+ fontSize: "15px",
422
+ lineHeight: "22px",
423
+ color: theme.ink,
424
+ ...extra,
425
+ });
426
+ const rule = `1px solid ${theme.line}`;
427
+ return (
428
+ <Cell style={{ padding: "8px 0 24px" }}>
429
+ <table
430
+ data-summary=""
431
+ role="presentation"
432
+ width="100%"
433
+ border={0}
434
+ cellPadding={0}
435
+ cellSpacing={0}
436
+ >
437
+ <tbody>
438
+ {items.map((item, i) => (
439
+ <tr key={i}>
440
+ <td style={cell("start", { borderBottom: rule })}>
441
+ {item.name}
442
+ {item.quantity !== undefined && item.quantity !== 1 && (
443
+ <span style={{ color: theme.muted }}> × {item.quantity}</span>
444
+ )}
445
+ {item.meta && (
446
+ <>
447
+ <br />
448
+ <span style={{ fontSize: "13px", color: theme.muted }}>
449
+ {item.meta}
450
+ </span>
451
+ </>
452
+ )}
453
+ </td>
454
+ <td
455
+ style={cell("end", {
456
+ borderBottom: rule,
457
+ whiteSpace: "nowrap",
458
+ [start === "left" ? "paddingLeft" : "paddingRight"]: "16px",
459
+ })}
460
+ >
461
+ {item.price}
462
+ </td>
463
+ </tr>
464
+ ))}
465
+ {lines.map((line, i) => (
466
+ <tr key={`line-${i}`}>
467
+ <td style={cell("start", { color: theme.secondary })}>
468
+ {line.label}
469
+ </td>
470
+ <td
471
+ style={cell("end", {
472
+ color: theme.secondary,
473
+ whiteSpace: "nowrap",
474
+ })}
475
+ >
476
+ {line.value}
477
+ </td>
478
+ </tr>
479
+ ))}
480
+ <tr>
481
+ <td style={cell("start", { borderTop: rule, fontWeight: 600 })}>
482
+ {total.label}
483
+ </td>
484
+ <td
485
+ style={cell("end", {
486
+ borderTop: rule,
487
+ fontWeight: 600,
488
+ whiteSpace: "nowrap",
489
+ })}
490
+ >
491
+ {total.value}
492
+ </td>
493
+ </tr>
494
+ </tbody>
495
+ </table>
496
+ </Cell>
497
+ );
498
+ }
499
+
315
500
  export interface RenderedEmail {
316
501
  html: string;
317
502
  /** The plain-text alternative: send it with the HTML. */
@@ -325,89 +510,19 @@ export interface RenderedEmail {
325
510
  export async function renderEmail(element: ReactNode): Promise<RenderedEmail> {
326
511
  const [html, text] = await Promise.all([
327
512
  render(element),
328
- render(element, { plainText: true }),
513
+ render(element, {
514
+ plainText: true,
515
+ htmlToTextOptions: {
516
+ // A summary reads as rows of label and amount, not run together.
517
+ selectors: [
518
+ {
519
+ selector: "table[data-summary]",
520
+ format: "dataTable",
521
+ options: { maxColumnWidth: 48 },
522
+ },
523
+ ],
524
+ },
525
+ }),
329
526
  ]);
330
527
  return { html, text };
331
528
  }
332
-
333
- /* Templates */
334
-
335
- export interface VerifyEmailProps {
336
- /** Your product, as the person knows it. */
337
- productName: string;
338
- /** A one-time code to type in, shown large. */
339
- code?: string;
340
- /** A confirmation link, shown as a button. Give `code`, `href` or both. */
341
- href?: string;
342
- /** The address being confirmed. */
343
- recipient?: string;
344
- /** Preformatted, e.g. "10 minutes". */
345
- expiresIn?: string;
346
- theme?: EmailTheme;
347
- logo?: EmailLogo;
348
- /** Replaces the default "if this wasn't you" footer. */
349
- footer?: ReactNode;
350
- lang?: string;
351
- }
352
- /**
353
- * Confirms an email address with a code, a link or both: the email for the
354
- * auth flow's verify-email step.
355
- */
356
- export function VerifyEmail({
357
- productName,
358
- code,
359
- href,
360
- recipient,
361
- expiresIn,
362
- theme,
363
- logo,
364
- footer,
365
- lang,
366
- }: VerifyEmailProps) {
367
- if (!code && !href)
368
- throw new Error("Mortar VerifyEmail needs a `code`, an `href` or both.");
369
- const address = recipient ?? "your email address";
370
- return (
371
- <EmailShell
372
- preview={`Confirm your email address for ${productName}`}
373
- theme={theme}
374
- logo={logo}
375
- lang={lang}
376
- footer={
377
- footer ??
378
- `You received this email because this address was used to sign up for ${productName}. If that wasn't you, you can ignore it.`
379
- }
380
- >
381
- <EmailHeading>Confirm your email address</EmailHeading>
382
- {code && (
383
- <>
384
- <EmailText>
385
- Enter this code in {productName} to confirm {address}:
386
- </EmailText>
387
- <EmailCode code={code} />
388
- </>
389
- )}
390
- {href && (
391
- <>
392
- <EmailText>
393
- {code
394
- ? "Or confirm with one click:"
395
- : `Confirm ${address} to finish setting up your ${productName} account.`}
396
- </EmailText>
397
- <EmailButton href={href}>Confirm email address</EmailButton>
398
- <EmailText tone="muted" size="sm">
399
- If the button doesn't work, paste this link into your browser:{" "}
400
- <EmailLink href={href} />
401
- </EmailText>
402
- </>
403
- )}
404
- {expiresIn && (
405
- <EmailText tone="muted" size="sm">
406
- {code && href
407
- ? `This code and link expire in ${expiresIn}.`
408
- : `This ${code ? "code" : "link"} expires in ${expiresIn}.`}
409
- </EmailText>
410
- )}
411
- </EmailShell>
412
- );
413
- }
@@ -0,0 +1,355 @@
1
+ /* Email templates for @tonycodes-ui/mortar/email: the transactional emails
2
+ most products send, composed only from the email components. Copy follows
3
+ docs/auth-flows.md: say why the email came and what to do if it wasn't
4
+ expected, and never reveal more than the link or code needs. */
5
+
6
+ import type { ReactNode } from "react";
7
+ import type { EmailTheme } from "./email-theme.js";
8
+ import {
9
+ EmailButton,
10
+ EmailCallout,
11
+ EmailCode,
12
+ EmailHeading,
13
+ EmailLink,
14
+ EmailShell,
15
+ EmailSummary,
16
+ EmailText,
17
+ type EmailLogo,
18
+ type EmailSummaryItem,
19
+ } from "./email-components.js";
20
+
21
+ /** Props every template takes. */
22
+ export interface EmailTemplateProps {
23
+ /** Your product, as the person knows it. */
24
+ productName: string;
25
+ /** From `emailTheme(brand)`; Mortar's neutral theme by default. */
26
+ theme?: EmailTheme;
27
+ logo?: EmailLogo;
28
+ /** Replaces the template's footer, which says why the email was sent. */
29
+ footer?: ReactNode;
30
+ lang?: string;
31
+ dir?: "ltr" | "rtl";
32
+ }
33
+
34
+ /* The main action, then its URL for clients that block buttons. */
35
+ function Action({ href, label }: { href: string; label: string }) {
36
+ return (
37
+ <>
38
+ <EmailButton href={href}>{label}</EmailButton>
39
+ <EmailText tone="muted" size="sm">
40
+ If the button doesn't work, paste this link into your browser:{" "}
41
+ <EmailLink href={href} />
42
+ </EmailText>
43
+ </>
44
+ );
45
+ }
46
+
47
+ function Detail({ children }: { children: ReactNode }) {
48
+ return (
49
+ <EmailText tone="muted" size="sm">
50
+ {children}
51
+ </EmailText>
52
+ );
53
+ }
54
+
55
+ export interface VerifyEmailProps extends EmailTemplateProps {
56
+ /** A one-time code to type in, shown large. */
57
+ code?: string;
58
+ /** A confirmation link, shown as a button. Give `code`, `href` or both. */
59
+ href?: string;
60
+ /** The address being confirmed. */
61
+ recipient?: string;
62
+ /** Preformatted, e.g. "10 minutes". */
63
+ expiresIn?: string;
64
+ }
65
+ /**
66
+ * Confirms an email address with a code, a link or both: the email for the
67
+ * auth flow's verify-email step.
68
+ */
69
+ export function VerifyEmail({
70
+ productName,
71
+ code,
72
+ href,
73
+ recipient,
74
+ expiresIn,
75
+ footer,
76
+ ...shell
77
+ }: VerifyEmailProps) {
78
+ if (!code && !href)
79
+ throw new Error("Mortar VerifyEmail needs a `code`, an `href` or both.");
80
+ const address = recipient ?? "your email address";
81
+ return (
82
+ <EmailShell
83
+ {...shell}
84
+ preview={`Confirm your email address for ${productName}`}
85
+ footer={
86
+ footer ??
87
+ `You received this email because this address was used to sign up for ${productName}. If that wasn't you, you can ignore it.`
88
+ }
89
+ >
90
+ <EmailHeading>Confirm your email address</EmailHeading>
91
+ {code && (
92
+ <>
93
+ <EmailText>
94
+ Enter this code in {productName} to confirm {address}:
95
+ </EmailText>
96
+ <EmailCode code={code} />
97
+ </>
98
+ )}
99
+ {href && (
100
+ <>
101
+ <EmailText>
102
+ {code
103
+ ? "Or confirm with one click:"
104
+ : `Confirm ${address} to finish setting up your ${productName} account.`}
105
+ </EmailText>
106
+ <Action href={href} label="Confirm email address" />
107
+ </>
108
+ )}
109
+ {expiresIn && (
110
+ <Detail>
111
+ {code && href
112
+ ? `This code and link expire in ${expiresIn}.`
113
+ : `This ${code ? "code" : "link"} expires in ${expiresIn}.`}
114
+ </Detail>
115
+ )}
116
+ </EmailShell>
117
+ );
118
+ }
119
+
120
+ export interface MagicLinkProps extends EmailTemplateProps {
121
+ /** The sign-in link. */
122
+ href: string;
123
+ /** Preformatted, e.g. "15 minutes". */
124
+ expiresIn?: string;
125
+ /** Where the request came from, e.g. "Chrome on macOS, near London". */
126
+ requestedFrom?: string;
127
+ }
128
+ /** A passwordless sign-in link: the email behind SignInPanel. */
129
+ export function MagicLink({
130
+ productName,
131
+ href,
132
+ expiresIn,
133
+ requestedFrom,
134
+ footer,
135
+ ...shell
136
+ }: MagicLinkProps) {
137
+ return (
138
+ <EmailShell
139
+ {...shell}
140
+ preview={`Your sign-in link for ${productName}`}
141
+ footer={
142
+ footer ??
143
+ `You received this email because someone asked to sign in to ${productName} with this address. If that wasn't you, you can ignore it.`
144
+ }
145
+ >
146
+ <EmailHeading>Sign in to {productName}</EmailHeading>
147
+ <EmailText>Use the link below to sign in to {productName}.</EmailText>
148
+ <Action href={href} label={`Sign in to ${productName}`} />
149
+ {expiresIn && <Detail>This link expires in {expiresIn}.</Detail>}
150
+ {requestedFrom && <Detail>Requested from {requestedFrom}.</Detail>}
151
+ </EmailShell>
152
+ );
153
+ }
154
+
155
+ export interface PasswordResetProps extends EmailTemplateProps {
156
+ /** The reset link. */
157
+ href: string;
158
+ /** The account's address, shown so the person knows which account. */
159
+ recipient?: string;
160
+ /** Preformatted, e.g. "1 hour". */
161
+ expiresIn?: string;
162
+ /** Where the request came from, e.g. "Firefox on Windows". */
163
+ requestedFrom?: string;
164
+ }
165
+ /**
166
+ * The link for the auth flow's reset-password step. Send it only to an
167
+ * address that has an account, and show the same "check your email" page
168
+ * either way, so the form never reveals whether an account exists.
169
+ */
170
+ export function PasswordReset({
171
+ productName,
172
+ href,
173
+ recipient,
174
+ expiresIn,
175
+ requestedFrom,
176
+ footer,
177
+ ...shell
178
+ }: PasswordResetProps) {
179
+ return (
180
+ <EmailShell
181
+ {...shell}
182
+ preview={`Reset your ${productName} password`}
183
+ footer={
184
+ footer ??
185
+ "If you didn't ask to reset your password, you can ignore this email. Your password won't change."
186
+ }
187
+ >
188
+ <EmailHeading>Reset your password</EmailHeading>
189
+ <EmailText>
190
+ We received a request to reset the password for{" "}
191
+ {recipient
192
+ ? `the ${productName} account ${recipient}`
193
+ : `your ${productName} account`}
194
+ . To choose a new password, use the link below.
195
+ </EmailText>
196
+ <Action href={href} label="Reset password" />
197
+ {expiresIn && <Detail>This link expires in {expiresIn}.</Detail>}
198
+ {requestedFrom && <Detail>Requested from {requestedFrom}.</Detail>}
199
+ </EmailShell>
200
+ );
201
+ }
202
+
203
+ export interface InviteProps extends EmailTemplateProps {
204
+ /** Who sent the invitation. */
205
+ inviterName: string;
206
+ /** The team or workspace; the product when omitted. */
207
+ workspaceName?: string;
208
+ /** The link to accept. */
209
+ href: string;
210
+ /** The inviter's own note, shown quoted. */
211
+ message?: string;
212
+ /** Preformatted, e.g. "7 days". */
213
+ expiresIn?: string;
214
+ }
215
+ /** An invitation to join a workspace. */
216
+ export function Invite({
217
+ productName,
218
+ inviterName,
219
+ workspaceName,
220
+ href,
221
+ message,
222
+ expiresIn,
223
+ footer,
224
+ ...shell
225
+ }: InviteProps) {
226
+ const target = workspaceName ?? productName;
227
+ return (
228
+ <EmailShell
229
+ {...shell}
230
+ preview={`${inviterName} invited you to ${target}`}
231
+ footer={
232
+ footer ??
233
+ `You received this email because ${inviterName} invited this address to ${productName}. If you weren't expecting it, you can ignore it.`
234
+ }
235
+ >
236
+ <EmailHeading>
237
+ {inviterName} invited you to {target}
238
+ </EmailHeading>
239
+ <EmailText>
240
+ {workspaceName
241
+ ? `Join the ${workspaceName} workspace on ${productName} to work with ${inviterName}.`
242
+ : `Join ${inviterName} on ${productName}.`}
243
+ </EmailText>
244
+ {message && (
245
+ <EmailCallout title={`Message from ${inviterName}`}>
246
+ {message}
247
+ </EmailCallout>
248
+ )}
249
+ <Action href={href} label="Accept invitation" />
250
+ {expiresIn && <Detail>This invitation expires in {expiresIn}.</Detail>}
251
+ </EmailShell>
252
+ );
253
+ }
254
+
255
+ export interface ReceiptProps extends EmailTemplateProps {
256
+ orderNumber: string;
257
+ /** Preformatted, e.g. "6 November 2026". */
258
+ date: string;
259
+ items: EmailSummaryItem[];
260
+ /** Subtotal, shipping, tax, discounts. */
261
+ lines?: { label: string; value: string }[];
262
+ total: { label: string; value: string };
263
+ /** e.g. "Visa ending 4242". */
264
+ paymentMethod?: string;
265
+ /** The order in your app. */
266
+ href?: string;
267
+ /** Defaults to "Thanks for your order". */
268
+ title?: string;
269
+ }
270
+ /** An order confirmation or receipt, with items, costs and total. */
271
+ export function Receipt({
272
+ productName,
273
+ orderNumber,
274
+ date,
275
+ items,
276
+ lines,
277
+ total,
278
+ paymentMethod,
279
+ href,
280
+ title = "Thanks for your order",
281
+ footer,
282
+ ...shell
283
+ }: ReceiptProps) {
284
+ return (
285
+ <EmailShell
286
+ {...shell}
287
+ preview={`Your ${productName} receipt for order ${orderNumber}`}
288
+ footer={
289
+ footer ??
290
+ `You received this receipt for order ${orderNumber} from ${productName}. Keep it for your records.`
291
+ }
292
+ >
293
+ <EmailHeading>{title}</EmailHeading>
294
+ <Detail>
295
+ Order {orderNumber}, {date}
296
+ </Detail>
297
+ <EmailSummary items={items} lines={lines} total={total} />
298
+ {paymentMethod && <Detail>Paid with {paymentMethod}.</Detail>}
299
+ {href && <EmailButton href={href}>View order</EmailButton>}
300
+ </EmailShell>
301
+ );
302
+ }
303
+
304
+ export interface NotificationProps extends EmailTemplateProps {
305
+ title: string;
306
+ /** The inbox preview line; the title when omitted. */
307
+ preview?: string;
308
+ children: ReactNode;
309
+ /** One main action. */
310
+ action?: { label: string; href: string };
311
+ /** Where the person can change which emails they get. */
312
+ preferencesHref?: string;
313
+ }
314
+ /** A product notification: a title, a message and at most one action. */
315
+ export function Notification({
316
+ productName,
317
+ title,
318
+ preview,
319
+ children,
320
+ action,
321
+ preferencesHref,
322
+ footer,
323
+ ...shell
324
+ }: NotificationProps) {
325
+ return (
326
+ <EmailShell
327
+ {...shell}
328
+ preview={preview ?? title}
329
+ footer={
330
+ footer ?? (
331
+ <>
332
+ You received this email because of your notification settings in{" "}
333
+ {productName}.
334
+ {preferencesHref && (
335
+ <>
336
+ {" "}
337
+ <EmailLink href={preferencesHref}>
338
+ Manage email preferences
339
+ </EmailLink>
340
+ </>
341
+ )}
342
+ </>
343
+ )
344
+ }
345
+ >
346
+ <EmailHeading>{title}</EmailHeading>
347
+ {typeof children === "string" ? (
348
+ <EmailText>{children}</EmailText>
349
+ ) : (
350
+ children
351
+ )}
352
+ {action && <EmailButton href={action.href}>{action.label}</EmailButton>}
353
+ </EmailShell>
354
+ );
355
+ }