From d4c594423fce5df70bbfd5a394ab4ea74a4c4291 Mon Sep 17 00:00:00 2001
From: Tom Moor
Date: Thu, 8 Jul 2021 22:38:42 -0400
Subject: [PATCH] More email styling
---
server/emails/CollectionNotificationEmail.js | 6 +-
server/emails/DocumentNotificationEmail.js | 180 ++++++++++++++++++-
server/emails/InviteEmail.js | 2 +-
server/emails/WelcomeEmail.js | 4 +-
server/emails/components/Diff.js | 12 +-
5 files changed, 195 insertions(+), 9 deletions(-)
diff --git a/server/emails/CollectionNotificationEmail.js b/server/emails/CollectionNotificationEmail.js
index 3989469f83..f5447d8232 100644
--- a/server/emails/CollectionNotificationEmail.js
+++ b/server/emails/CollectionNotificationEmail.js
@@ -41,11 +41,13 @@ export const CollectionNotificationEmail = ({
{collection.name}
- {actor.name} {eventName} the collection "{collection.name}".
+ {actor.name} {eventName} the collection “{collection.name}”.
-
diff --git a/server/emails/DocumentNotificationEmail.js b/server/emails/DocumentNotificationEmail.js
index 71b44f4357..d9eda21bd5 100644
--- a/server/emails/DocumentNotificationEmail.js
+++ b/server/emails/DocumentNotificationEmail.js
@@ -44,13 +44,15 @@ export const DocumentNotificationEmail = ({
summary,
unsubscribeUrl,
}: Props) => {
+ const link = `${team.url}${document.url}?ref=notification-email`;
+
return (
- "{document.title}" {eventName}
+ “{document.title}” {eventName}
{actor.name} {eventName} the document "{document.title}", in the{" "}
@@ -59,14 +61,14 @@ export const DocumentNotificationEmail = ({
{summary && (
<>
-
+
>
)}
- Open Document
+ Open Document
@@ -76,6 +78,81 @@ export const DocumentNotificationEmail = ({
};
export const css = `
+ font-family: ${theme.fontFamily};
+ font-weight: ${theme.fontWeight};
+ font-size: 1em;
+ line-height: 1.7em;
+
+ pre {
+ white-space: pre-wrap;
+ }
+
+ img {
+ text-align: center;
+ max-width: 100%;
+ max-height: 75vh;
+ clear: both;
+ }
+
+ img.image-right-50 {
+ float: right;
+ width: 50%;
+ margin-left: 2em;
+ margin-bottom: 1em;
+ clear: initial;
+ }
+
+ img.image-left-50 {
+ float: left;
+ width: 50%;
+ margin-right: 2em;
+ margin-bottom: 1em;
+ clear: initial;
+ }
+
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6 {
+ margin: 1em 0 0.5em;
+ font-weight: 500;
+ }
+
+ .notice {
+ display: flex;
+ align-items: center;
+ background: ${theme.noticeInfoBackground};
+ color: ${theme.noticeInfoText};
+ border-radius: 4px;
+ padding: 8px 16px;
+ margin: 8px 0;
+ }
+
+ .notice-tip {
+ background: ${theme.noticeTipBackground};
+ color: ${theme.noticeTipText};
+ }
+
+ .notice-warning {
+ background: ${theme.noticeWarningBackground};
+ color: ${theme.noticeWarningText};
+ }
+
+ b,
+ strong {
+ font-weight: 600;
+ }
+
+ p {
+ margin: 0;
+ }
+
+ a {
+ color: ${theme.link};
+ }
+
ins {
background-color: #128a2929;
text-decoration: none;
@@ -87,6 +164,45 @@ export const css = `
text-decoration: strikethrough;
}
+ hr {
+ position: relative;
+ height: 1em;
+ border: 0;
+ }
+ hr:before {
+ content: "";
+ display: block;
+ position: absolute;
+ border-top: 1px solid ${theme.horizontalRule};
+ top: 0.5em;
+ left: 0;
+ right: 0;
+ }
+
+ hr.page-break {
+ page-break-after: always;
+ }
+ hr.page-break:before {
+ border-top: 1px dashed ${theme.horizontalRule};
+ }
+
+ code {
+ border-radius: 4px;
+ border: 1px solid ${theme.codeBorder};
+ padding: 3px 4px;
+ font-family: ${theme.fontFamilyMono};
+ font-size: 85%;
+ }
+
+ mark {
+ border-radius: 1px;
+ color: ${theme.textHighlightForeground};
+ background: ${theme.textHighlight};
+ a {
+ color: ${theme.textHighlightForeground};
+ }
+ }
+
ul {
padding-left: 0;
}
@@ -109,4 +225,62 @@ export const css = `
border: 1px solid ${theme.textSecondary};
border-radius: 3px;
}
+
+ pre {
+ display: block;
+ overflow-x: auto;
+ padding: 0.75em 1em;
+ line-height: 1.4em;
+ position: relative;
+ background: ${theme.codeBackground};
+ border-radius: 4px;
+ border: 1px solid ${theme.codeBorder};
+ -webkit-font-smoothing: initial;
+ font-family: ${theme.fontFamilyMono};
+ font-size: 13px;
+ direction: ltr;
+ text-align: left;
+ white-space: pre;
+ word-spacing: normal;
+ word-break: normal;
+ -moz-tab-size: 4;
+ -o-tab-size: 4;
+ tab-size: 4;
+ -webkit-hyphens: none;
+ -moz-hyphens: none;
+ -ms-hyphens: none;
+ hyphens: none;
+ margin: 0;
+
+ code {
+ font-size: 13px;
+ background: none;
+ padding: 0;
+ border: 0;
+ }
+ }
+
+ table {
+ width: 100%;
+ border-collapse: collapse;
+ border-radius: 4px;
+ margin-top: 1em;
+ box-sizing: border-box;
+ * {
+ box-sizing: border-box;
+ }
+ tr {
+ position: relative;
+ border-bottom: 1px solid ${theme.tableDivider};
+ }
+ td,
+ th {
+ position: relative;
+ vertical-align: top;
+ border: 1px solid ${theme.tableDivider};
+ position: relative;
+ padding: 4px 8px;
+ min-width: 100px;
+ }
+ }
`;
diff --git a/server/emails/InviteEmail.js b/server/emails/InviteEmail.js
index a293aa14cf..491333f4e3 100644
--- a/server/emails/InviteEmail.js
+++ b/server/emails/InviteEmail.js
@@ -47,7 +47,7 @@ export const InviteEmail = ({
- Join now
+ Join now
diff --git a/server/emails/WelcomeEmail.js b/server/emails/WelcomeEmail.js
index 6745a8d886..c8994324a5 100644
--- a/server/emails/WelcomeEmail.js
+++ b/server/emails/WelcomeEmail.js
@@ -43,7 +43,9 @@ export const WelcomeEmail = ({ teamUrl }: Props) => {
- View my dashboard
+
+ View my dashboard
+