diff --git a/ghost/core/core/server/services/mega/feedback-buttons.js b/ghost/core/core/server/services/mega/feedback-buttons.js index 9ae2e4e3df..ede88275cf 100644 --- a/ghost/core/core/server/services/mega/feedback-buttons.js +++ b/ghost/core/core/server/services/mega/feedback-buttons.js @@ -18,15 +18,27 @@ const generateLinks = (postId, uuid, html) => { 0 ); - html = html.replace(templateStrings.like, positiveLink.href); - html = html.replace(templateStrings.dislike, negativeLink.href); + html = html.replace(new RegExp(templateStrings.like, 'g'), positiveLink.href); + html = html.replace(new RegExp(templateStrings.dislike, 'g'), negativeLink.href); return html; }; const getTemplate = (accentColor) => { - const likeButtonHtml = getButtonHtml(templateStrings.like, 'More like this', accentColor); - const dislikeButtonHtml = getButtonHtml(templateStrings.dislike, 'Less like this', accentColor); + const likeButtonHtml = getButtonHtml( + templateStrings.like, + 'More like this', + accentColor, + 'like-icon', + 'https://static.ghost.org/v5.0.0/images/thumbs-up.png' + ); + const dislikeButtonHtml = getButtonHtml( + templateStrings.dislike, + 'Less like this', + accentColor, + 'dislike-icon', + 'https://static.ghost.org/v5.0.0/images/thumbs-down.png' + ); return (` @@ -43,19 +55,44 @@ const getTemplate = (accentColor) => { `); }; -function getButtonHtml(href, buttonText, accentColor) { - const color = new Color(accentColor); - const bgColor = `${accentColor}10`; - const textColor = color.darken(0.6).hex(); +function getButtonHtml(href, buttonText, accentColor, className, iconUrl) { + const bgColor = getButtonLightTheme(accentColor).backgroundColor; + const textColor = getButtonLightTheme(accentColor).color; return (` - - +
+ - + + @@ -63,7 +100,41 @@ function getButtonHtml(href, buttonText, accentColor) { `); } +function getButtonLightTheme(accentColor) { + const color = new Color(accentColor); + const backgroundColor = `${accentColor}10`; + const textColor = color.darken(0.6).hex(); + + return { + color: textColor, + backgroundColor + }; +} + +function getButtonsHeadStyles() { + return (` + .like-icon { + mix-blend-mode: darken; + } + + .dislike-icon { + mix-blend-mode: darken; + } + + @media (prefers-color-scheme: dark) { + .like-icon { + mix-blend-mode: initial !important; + } + + .dislike-icon { + mix-blend-mode: initial !important; + } + } +`); +} + module.exports = { generateLinks, - getTemplate + getTemplate, + getButtonsHeadStyles }; diff --git a/ghost/core/core/server/services/mega/template.js b/ghost/core/core/server/services/mega/template.js index d67bcc15d5..fbdfb7cea7 100644 --- a/ghost/core/core/server/services/mega/template.js +++ b/ghost/core/core/server/services/mega/template.js @@ -37,6 +37,7 @@ module.exports = ({post, site, newsletter, templateSettings}) => { + ${cleanPost.title} diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/email-previews.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/email-previews.test.js.snap index 677ab84a1b..21169e4b89 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/email-previews.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/email-previews.test.js.snap @@ -100,6 +100,7 @@ Object { + Post with email-only card