|
| 1 | +import { |
| 2 | + Body, |
| 3 | + Button, |
| 4 | + Container, |
| 5 | + Column, |
| 6 | + Head, |
| 7 | + Heading, |
| 8 | + Hr, |
| 9 | + Html, |
| 10 | + Img, |
| 11 | + Link, |
| 12 | + Preview, |
| 13 | + Row, |
| 14 | + Section, |
| 15 | + Text, |
| 16 | +} from "@react-email/components"; |
| 17 | +import { Tailwind } from "@react-email/tailwind"; |
| 18 | +import * as React from "react"; |
| 19 | + |
| 20 | +interface VercelInviteUserEmailProps { |
| 21 | + username?: string; |
| 22 | + userImage?: string; |
| 23 | + invitedByUsername?: string; |
| 24 | + invitedByEmail?: string; |
| 25 | + teamName?: string; |
| 26 | + teamImage?: string; |
| 27 | + inviteLink?: string; |
| 28 | + inviteFromIp?: string; |
| 29 | + inviteFromLocation?: string; |
| 30 | +} |
| 31 | + |
| 32 | +const baseUrl = process.env.VERCEL_URL |
| 33 | + ? `https://${process.env.VERCEL_URL}` |
| 34 | + : ""; |
| 35 | + |
| 36 | +export const VercelInviteUserEmail = ({ |
| 37 | + username, |
| 38 | + userImage, |
| 39 | + invitedByUsername, |
| 40 | + invitedByEmail, |
| 41 | + teamName, |
| 42 | + teamImage, |
| 43 | + inviteLink, |
| 44 | + inviteFromIp, |
| 45 | + inviteFromLocation, |
| 46 | +}: VercelInviteUserEmailProps) => { |
| 47 | + const previewText = `Join ${invitedByUsername} on Vercel`; |
| 48 | + |
| 49 | + return ( |
| 50 | + <Html> |
| 51 | + <Head /> |
| 52 | + <Preview>{previewText}</Preview> |
| 53 | + <Tailwind> |
| 54 | + <Body className="bg-white my-auto mx-auto font-sans px-2"> |
| 55 | + <Container className="border border-solid border-[#eaeaea] rounded my-[40px] mx-auto p-[20px] max-w-[465px]"> |
| 56 | + <Section className="mt-[32px]"> |
| 57 | + <Img |
| 58 | + src={`${baseUrl}/static/vercel-logo.png`} |
| 59 | + width="40" |
| 60 | + height="37" |
| 61 | + alt="Vercel" |
| 62 | + className="my-0 mx-auto" |
| 63 | + /> |
| 64 | + </Section> |
| 65 | + <Heading className="text-black text-[24px] font-normal text-center p-0 my-[30px] mx-0"> |
| 66 | + Join <strong>{teamName}</strong> on <strong>Vercel</strong> |
| 67 | + </Heading> |
| 68 | + <Text className="text-black text-[14px] leading-[24px]"> |
| 69 | + Hello {username}, |
| 70 | + </Text> |
| 71 | + <Text className="text-black text-[14px] leading-[24px]"> |
| 72 | + <strong>{invitedByUsername}</strong> ( |
| 73 | + <Link |
| 74 | + href={`mailto:${invitedByEmail}`} |
| 75 | + className="text-blue-600 no-underline" |
| 76 | + > |
| 77 | + {invitedByEmail} |
| 78 | + </Link> |
| 79 | + ) has invited you to the <strong>{teamName}</strong> team on{" "} |
| 80 | + <strong>Vercel</strong>. |
| 81 | + </Text> |
| 82 | + <Section> |
| 83 | + <Row> |
| 84 | + <Column align="right"> |
| 85 | + <Img |
| 86 | + className="rounded-full" |
| 87 | + src={userImage} |
| 88 | + width="64" |
| 89 | + height="64" |
| 90 | + /> |
| 91 | + </Column> |
| 92 | + <Column align="center"> |
| 93 | + <Img |
| 94 | + src={`${baseUrl}/static/vercel-arrow.png`} |
| 95 | + width="12" |
| 96 | + height="9" |
| 97 | + alt="invited you to" |
| 98 | + /> |
| 99 | + </Column> |
| 100 | + <Column align="left"> |
| 101 | + <Img |
| 102 | + className="rounded-full" |
| 103 | + src={teamImage} |
| 104 | + width="64" |
| 105 | + height="64" |
| 106 | + /> |
| 107 | + </Column> |
| 108 | + </Row> |
| 109 | + </Section> |
| 110 | + <Section className="text-center mt-[32px] mb-[32px]"> |
| 111 | + <Button |
| 112 | + className="bg-[#000000] rounded text-white text-[12px] font-semibold no-underline text-center px-5 py-3" |
| 113 | + href={inviteLink} |
| 114 | + > |
| 115 | + Join the team |
| 116 | + </Button> |
| 117 | + </Section> |
| 118 | + <Text className="text-black text-[14px] leading-[24px]"> |
| 119 | + or copy and paste this URL into your browser:{" "} |
| 120 | + <Link href={inviteLink} className="text-blue-600 no-underline"> |
| 121 | + {inviteLink} |
| 122 | + </Link> |
| 123 | + </Text> |
| 124 | + <Hr className="border border-solid border-[#eaeaea] my-[26px] mx-0 w-full" /> |
| 125 | + <Text className="text-[#666666] text-[12px] leading-[24px]"> |
| 126 | + This invitation was intended for{" "} |
| 127 | + <span className="text-black">{username}</span>. This invite was |
| 128 | + sent from <span className="text-black">{inviteFromIp}</span>{" "} |
| 129 | + located in{" "} |
| 130 | + <span className="text-black">{inviteFromLocation}</span>. If you |
| 131 | + were not expecting this invitation, you can ignore this email. If |
| 132 | + you are concerned about your account's safety, please reply to |
| 133 | + this email to get in touch with us. |
| 134 | + </Text> |
| 135 | + </Container> |
| 136 | + </Body> |
| 137 | + </Tailwind> |
| 138 | + </Html> |
| 139 | + ); |
| 140 | +}; |
| 141 | + |
| 142 | +VercelInviteUserEmail.PreviewProps = { |
| 143 | + username: "alanturing", |
| 144 | + userImage: `${baseUrl}/static/vercel-user.png`, |
| 145 | + invitedByUsername: "Alan", |
| 146 | + invitedByEmail: "[email protected]", |
| 147 | + teamName: "Enigma", |
| 148 | + teamImage: `${baseUrl}/static/vercel-team.png`, |
| 149 | + inviteLink: "https://vercel.com/teams/invite/foo", |
| 150 | + inviteFromIp: "204.13.186.218", |
| 151 | + inviteFromLocation: "São Paulo, Brazil", |
| 152 | +} as VercelInviteUserEmailProps; |
0 commit comments