| 1 | import { Section, Text } from '@react-email/components' |
| 2 | import { env } |
| 3 | import { |
| 4 | ActionButton, |
| 5 | EmailLayout, |
| 6 | InfoCard, |
| 7 | InfoRow, |
| 8 | text, |
| 9 | } from '../components/layout' |
| 10 | |
| 11 | const baseUrl = env |
| 12 | |
| 13 | interface ProjectDueDateReminderEmailProps { |
| 14 | daysRemaining: number |
| 15 | dueDate: string |
| 16 | organizationName: string |
| 17 | orgSlug: string |
| 18 | projectName: string |
| 19 | projectSlug: string |
| 20 | recipientName: string |
| 21 | } |
| 22 | |
| 23 | export default function ProjectDueDateReminderEmail |
| 24 | recipientName = 'John Doe' |
| 25 | projectName = 'Website Redesign' |
| 26 | organizationName = 'Acme Studio' |
| 27 | dueDate = 'March 15, 2026' |
| 28 | daysRemaining = 3, |
| 29 | orgSlug = 'acme' |
| 30 | projectSlug = 'website-redesign' |
| 31 | }: ProjectDueDateReminderEmailProps) |
| 32 | const isOverdue = |
| 33 | const absDays = |
| 34 | const accentColor = |
| 35 | |
| 36 | const countdownText = |
| 37 | ? `${absDays} day |
| 38 | : `${daysRemaining} day |
| 39 | |
| 40 | return ( |
| 41 | <EmailLayout |
| 42 | accentColor={accentColor} |
| 43 | heading={isOverdue ? |
| 44 | preview={`${projectName |
| 45 | > |
| 46 | <Text style={ |
| 47 | Hi {recipientName}, <span |
| 48 | {organizationName} {isOverdue |
| 49 | <span style={text |
| 50 | </Text> |
| 51 | <Section style={ |
| 52 | <Text style={ |
| 53 | <Text style={ |
| 54 | {isOverdue |
| 55 | ? `day${absDays |
| 56 | : `day${daysRemaining |
| 57 | </Text> |
| 58 | </Section> |
| 59 | <InfoCard> |
| 60 | <InfoRow label=' |
| 61 | <InfoRow label=' |
| 62 | <InfoRow label=' |
| 63 | </InfoCard> |
| 64 | <ActionButton |
| 65 | color={accentColor} |
| 66 | href={`${baseUrl |
| 67 | > |
| 68 | View Project |
| 69 | </ActionButton> |
| 70 | </EmailLayout> |
| 71 | ) |
| 72 | } |
| 73 | |
| 74 | const countdownSection = { |
| 75 | textAlign: 'center' as |
| 76 | padding: '16px 0 8px', |
| 77 | } |
| 78 | |
| 79 | const countdownLabel = { |
| 80 | fontSize: '13px', |
| 81 | color: '#71717a', |
| 82 | fontWeight: '500' as |
| 83 | margin: '4px 0 0', |
| 84 | textAlign: 'center' as |
| 85 | textTransform: 'uppercase' as |
| 86 | letterSpacing: '0.5px', |
| 87 | } |