Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Various newsletter improvements #131

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions src/emails/templates/NewsletterEmail.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import { hexToRGBA } from '@/utils/color';
import { applyInlineStyleToRawHtml } from '@/utils/newsletter';
import { BookmarkDigestStyle, DigestBlockType } from '@prisma/client';
import {
Mjml,
MjmlAll,
MjmlAttributes,
MjmlBody,
MjmlBreakpoint,
MjmlColumn,
MjmlHead,
MjmlImage,
MjmlSection,
MjmlText,
MjmlWrapper,
MjmlAttributes,
MjmlAll,
MjmlHead,
MjmlBreakpoint,
MjmlRaw,
} from 'mjml-react';
import React from 'react';
import { remark } from 'remark';
import html from 'remark-html';
import theme from '../theme';
import { hexToRGBA } from '@/utils/color';

const Bookmark = ({
bookmark: { title, description, url, image, style },
Expand Down Expand Up @@ -69,7 +68,7 @@ const Bookmark = ({

{isBlock && (
<MjmlColumn width="40%">
<MjmlImage src={image!} alt={title || 'Bookmark'} />
<MjmlImage src={image!} alt={title || 'Bookmark'} href={url!} />
</MjmlColumn>
)}

Expand Down Expand Up @@ -163,14 +162,6 @@ const NewsletterEmail = ({
<MjmlWrapper backgroundColor="white" borderRadius={10} cssClass="mt-1">
<MjmlSection>
<MjmlColumn width="100%">
<MjmlText>
<a
href={`${hostUrl}/${team.slug}/${digestSlug}`}
style={{ color: `${primaryColor} !important` }}
>
Open website version 🌐
</a>
</MjmlText>
<MjmlText
fontWeight={800}
fontSize={34}
Expand All @@ -197,7 +188,7 @@ const NewsletterEmail = ({
blocks.map((block, i) => {
if (block.type === BlockType.BOOKMARK) {
if (block.style === 'TWEET_EMBED') {
// maybe render tweets with their own cloomponent? to cleanly embed
// maybe render tweets with their own component? to cleanly embed
return (
<Bookmark
bookmark={block}
Expand Down Expand Up @@ -248,6 +239,16 @@ const NewsletterEmail = ({
.
</MjmlText>
</MjmlColumn>
<MjmlColumn width={'100%'}>
<MjmlText>
<a
href={`${hostUrl}/${team.slug}/${digestSlug}`}
style={{ color: `${primaryColor} !important` }}
>
Open website version 🌐
</a>
</MjmlText>
</MjmlColumn>
</MjmlSection>
</MjmlWrapper>
</MjmlBody>
Expand Down
2 changes: 1 addition & 1 deletion src/emails/theme.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const theme = {
fontFamily: {
heading: 'Arial Rounded MT Bold, Arial, Arial, sans-serif',
heading: 'Helvetica, sans-serif',
bodyPrimary: 'Helvetica, sans-serif',
bodySecondary: 'Arial, sans-serif',
},
Expand Down
Loading