-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from drewlyton/react-email
React email
- Loading branch information
Showing
44 changed files
with
5,696 additions
and
1,291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
public | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ node_modules | |
|
||
# Local Netlify folder | ||
.netlify | ||
|
||
.react-email | ||
|
||
# Contentlayer | ||
.contentlayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export default gql` | ||
query Newsletters($issueNumber: Int) { | ||
newsletter(where: { issueNumber: $issueNumber }) { | ||
createdAt | ||
publishedAt | ||
id | ||
issueNumber | ||
messageBody | ||
preview | ||
subject | ||
publishedAt | ||
updatedAt | ||
story { | ||
title | ||
description | ||
featuredImage { | ||
url | ||
} | ||
slug | ||
author { | ||
name | ||
bio | ||
picture { | ||
url | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { gql } from "graphql-request"; | ||
|
||
export default gql` | ||
query Newsletters { | ||
newsletters(orderBy: publishedAt_DESC) { | ||
createdAt | ||
publishedAt | ||
id | ||
issueNumber | ||
messageBody | ||
preview | ||
subject | ||
publishedAt | ||
updatedAt | ||
story { | ||
title | ||
description | ||
featuredImage { | ||
url | ||
} | ||
slug | ||
author { | ||
name | ||
bio | ||
picture { | ||
url | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type Story from "./Story"; | ||
|
||
export type Newsletter = { | ||
createdAt: string; | ||
publishedAt: string; | ||
id: string; | ||
issueNumber: number; | ||
messageBody: string; | ||
preview: boolean; | ||
subject: string; | ||
updatedAt: string; | ||
story: Story; | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import client from "@sendgrid/client"; | ||
import mail from "@sendgrid/mail"; | ||
client.setApiKey(process.env.SENDGRID_API_KEY); | ||
mail.setApiKey(process.env.SENDGRID_API_KEY); | ||
|
||
export { client as sendgridClient, mail as sendgridMailer }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Column, Img, Link, Row, Section, Text } from "@react-email/components"; | ||
|
||
export function ConfirmSubscription({ recipient }: { recipient: string }) { | ||
return ( | ||
<Section> | ||
<Row> | ||
<Text className="text-2xl font-serif font-semibold"> | ||
Hey friend 👋, | ||
</Text> | ||
<Text className="text-base"> | ||
Thanks for subscribing to my newsletter! | ||
</Text> | ||
<Text className="text-base"> | ||
Click the link below to confirm your subscription and recieve a | ||
notification whenever I post something new: | ||
</Text> | ||
<Link | ||
href={`https://drewis.cool/newsletter/confirm?email=${recipient}`} | ||
className="text-xl underline" | ||
> | ||
Confirm Subscription | ||
</Link> | ||
</Row> | ||
<Text className="text-sm font-semibold mt-6 ">Best,</Text> | ||
<Row className="mb-8"> | ||
<Column className="w-[40px]" valign="top"> | ||
<Img | ||
src={"https://media.graphassets.com/DaEP4yDeQkuwmEl0hfrf"} | ||
width={"100%"} | ||
/> | ||
</Column> | ||
<Column> | ||
<Text className="text-base ml-4 my-0">Drew Lyton</Text> | ||
</Column> | ||
</Row> | ||
<Row> | ||
<Text className="mt-8 italic text-gray-500 mb-1 font-bold"> | ||
Received this by mistake? | ||
</Text> | ||
<Text className="text-gray-500 m-0"> | ||
Feel free to disregard this email - I won't send you anything unless | ||
you click the link above. Have a wonderful day 👍 | ||
</Text> | ||
</Row> | ||
</Section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
Button, | ||
Column, | ||
Hr, | ||
Img, | ||
Link, | ||
Section, | ||
Text | ||
} from "@react-email/components"; | ||
|
||
export function EmailFooter({ recipient }: { recipient: string }) { | ||
const baseUrl = | ||
process.env.NODE_ENV === "development" | ||
? "http://localhost:3000" | ||
: "https://www.drewis.cool"; | ||
|
||
return ( | ||
<> | ||
<Hr className="my-7" /> | ||
<Section className="mb-5"> | ||
<Column align="left"> | ||
<Link href="https://www.drewis.cool/?ref=newsletter" target="_blank"> | ||
<Img | ||
src={"https://www.drewis.cool/static/logo-text.png"} | ||
width="96" | ||
alt="Drew's logo - a handrawn symbol of the letter D." | ||
/> | ||
</Link> | ||
</Column> | ||
<Column align="right"> | ||
<Button | ||
className="text-gray-500 text-xs " | ||
href={`${baseUrl}/newsletter/unsubscribe?recipient=${recipient}`} | ||
> | ||
Unsubscribe | ||
</Button> | ||
</Column> | ||
</Section> | ||
<Section> | ||
<Text className="text-[8px] text-center text-bgApache"> | ||
<span className="block">998 Salisbury Square</span> | ||
<span className="block">Charlottesville, VA 22901</span> | ||
</Text> | ||
</Section> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Body, Container, Html, Section } from "@react-email/components"; | ||
import { EmailFooter } from "./EmailFooter"; | ||
import { TailwindEmailConfig } from "./TailwindEmailConfig"; | ||
import type { PropsWithChildren } from "react"; | ||
|
||
export const EmailLayout: React.FC< | ||
PropsWithChildren<{ recipient: string }> | ||
> = ({ children, recipient }) => { | ||
return ( | ||
<TailwindEmailConfig> | ||
<Html> | ||
<Body className="font-sans bg-bgApache"> | ||
<Section> | ||
<Container> | ||
{children} | ||
<EmailFooter recipient={recipient} /> | ||
</Container> | ||
</Section> | ||
</Body> | ||
</Html> | ||
</TailwindEmailConfig> | ||
); | ||
}; |
Oops, something went wrong.