Skip to content

Instantly share code, notes, and snippets.

@jodyheavener
Created August 12, 2021 15:50
Show Gist options
  • Save jodyheavener/3dd19b192c60bd2b8898e72ca994e20e to your computer and use it in GitHub Desktop.
Save jodyheavener/3dd19b192c60bd2b8898e72ca994e20e to your computer and use it in GitHub Desktop.
diff --git a/packages/fxa-auth-server/lib/senders/emails/storybook-email.ts b/packages/fxa-auth-server/lib/senders/emails/storybook-email.ts
index 601308432..5212f315a 100644
--- a/packages/fxa-auth-server/lib/senders/emails/storybook-email.ts
+++ b/packages/fxa-auth-server/lib/senders/emails/storybook-email.ts
@@ -17,17 +17,15 @@ export const storybookEmail = ({
}: StorybookEmailArgs): HTMLDivElement => {
const container = document.createElement('div');
container.innerHTML = 'Loading email...';
- const emailDescriptionDiv = document.createElement('div');
- if (doc) {
- emailDescriptionDiv.innerHTML = `<p>${doc}</p>`;
- }
- const subjectDiv = document.createElement('div');
renderUsingMJML({ template, layout, variables })
.then(({ html, subject }) => {
- subjectDiv.innerHTML = `<p>subject: ${subject}</p> <hr />`;
- container.innerHTML =
- emailDescriptionDiv.innerHTML + subjectDiv.innerHTML + html;
+ container.innerHTML = `
+ ${doc ? `<p>Template Description: ${doc}</p>` : ''}
+ <p>Email Subject: ${subject}</p>
+ <hr />
+ ${html}
+ `;
})
.catch((error: Error) => {
container.innerHTML = `Error loading email: ${error.message}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment