Skip to content

Commit b782f7b

Browse files
committed
feat: simplified email template, closer to standard implementations
1 parent 40c12ec commit b782f7b

4 files changed

Lines changed: 82 additions & 140 deletions

File tree

emails/pricing.tsx

Lines changed: 0 additions & 140 deletions
This file was deleted.

emails/welcome.tsx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import {
2+
Body,
3+
Button,
4+
Container,
5+
Head,
6+
Heading,
7+
Hr,
8+
Html,
9+
Preview,
10+
Section,
11+
Tailwind,
12+
Text,
13+
} from '@react-email/components';
14+
import { createIntl } from 'react-intl';
15+
16+
interface WelcomeProps {
17+
locale: 'pt' | 'en';
18+
name: string;
19+
}
20+
21+
export async function Welcome({ locale, name }: WelcomeProps) {
22+
const { formatMessage } = createIntl({
23+
locale,
24+
messages: await import(`../messages/${locale}/welcome-email.json`),
25+
});
26+
27+
return (
28+
<Html>
29+
<Head />
30+
<Preview>{formatMessage({ id: 'header' })}</Preview>
31+
<Tailwind>
32+
<Body className="bg-gray-100 font-sans">
33+
<Container className="mx-auto py-10 px-5">
34+
<Section className="bg-white rounded-lg p-8">
35+
<Heading className="text-2xl font-bold text-gray-900 m-0 mb-6">
36+
{formatMessage({ id: 'header' })}
37+
</Heading>
38+
<Text className="text-base leading-6 text-gray-600 m-0 mb-4">
39+
{formatMessage({ id: 'hi' })} {name}
40+
</Text>
41+
<Text className="text-base leading-6 text-gray-600 m-0 mb-4">
42+
{formatMessage({ id: 'thanks' })}
43+
</Text>
44+
<Button
45+
href="https://example.com/dashboard"
46+
className="bg-indigo-600 rounded-md text-white text-base font-semibold no-underline text-center block py-3 px-6 my-6"
47+
>
48+
{formatMessage({ id: 'get-started' })}
49+
</Button>
50+
<Hr className="border-gray-200 my-6" />
51+
<Text className="text-sm text-gray-400 m-0">
52+
{formatMessage({ id: 'questions' })}
53+
</Text>
54+
</Section>
55+
</Container>
56+
</Body>
57+
</Tailwind>
58+
</Html>
59+
);
60+
}
61+
62+
export default Welcome;
63+
64+
Welcome.PreviewProps = {
65+
name: 'John Lennon',
66+
locale: 'en',
67+
};
68+

messages/en/welcome-email.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"header": "Welcome to Acme",
3+
"hi": "Hi",
4+
"thanks": "Thanks for signing up! We're excited to have you on board.",
5+
"get-started": "Get Started",
6+
"questions": "If you have any questions, reply to this email. We're here to help!"
7+
}

messages/pt/welcome-email.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"header": "Bem-vindo à Acme",
3+
"hi": "Olá",
4+
"thanks": "Obrigado por se inscrever! Estamos animados em tê-lo conosco.",
5+
"get-started": "Começar",
6+
"questions": "Se você tiver alguma dúvida, responda a este e-mail. Estamos aqui para ajudar!"
7+
}

0 commit comments

Comments
 (0)