Skip to content

Commit eb8fabb

Browse files
committed
Add welcome template and selectTemplate function
1 parent 10088ca commit eb8fabb

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import WelcomeTemplate from "./welcome-template"
2+
3+
export enum EmailTemplates {
4+
WELCOME = "WELCOME",
5+
}
6+
7+
export function SelectEmailTemplate(data: any) {
8+
switch (data.template) {
9+
case EmailTemplates.WELCOME:
10+
return WelcomeTemplate({
11+
userName: data.userName,
12+
})
13+
14+
// more templates here
15+
}
16+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from "react"
2+
import EmailWrapper from "./email-wrapper"
3+
import { Container, Heading, Text } from "@react-email/components"
4+
5+
const WelcomeTemplate = ({ userName }: { userName: string }) => {
6+
return (
7+
<EmailWrapper previewText="Welcome to Pear AI" dir="ltr">
8+
<Container className="mx-auto -mt-3 max-w-[600px] rounded-xl bg-white px-8 py-5">
9+
<Heading as="h1">Hi {userName},</Heading>
10+
<Heading as="h2">Welcome to Pear AI!</Heading>
11+
<Text>
12+
We are excited to have you onboard and look forward to helping you get
13+
the most out of our product.
14+
</Text>
15+
<Text>
16+
If you have any questions or need assistance, please don't hesitate to
17+
reach out to us.
18+
</Text>
19+
</Container>
20+
</EmailWrapper>
21+
)
22+
}
23+
24+
export default WelcomeTemplate

0 commit comments

Comments
 (0)