Ship 23 transactional templates, shared brand tokens/logo, preview UI, render API, CHANGELOG, and docs for Ecom/Admin/B2B consumers. Co-authored-by: Cursor <cursoragent@cursor.com>
45 lines
1.6 KiB
TypeScript
45 lines
1.6 KiB
TypeScript
import { Heading, Section, Text } from '@react-email/components';
|
|
import { EmailLayout } from './components/EmailLayout';
|
|
import { Button } from './components/Button';
|
|
import { StatusBanner } from './components/StatusBanner';
|
|
import { styles } from './components/styles';
|
|
import { tCommon } from './i18n/common';
|
|
import { tTemplate } from './i18n/templates';
|
|
import { resolveLocale, type Locale } from './i18n/types';
|
|
import { interpolate } from './utils/interpolate';
|
|
import { theme } from './theme';
|
|
|
|
export interface PrescriptionReadyEmailProps {
|
|
locale?: Locale;
|
|
userName?: string;
|
|
rxId?: string;
|
|
branchName?: string;
|
|
ctaUrl?: string;
|
|
}
|
|
|
|
export const PrescriptionReadyEmail = ({
|
|
locale,
|
|
userName = 'Abebe Kebede',
|
|
rxId = 'RX-5521',
|
|
branchName = 'Bole Branch',
|
|
ctaUrl = `${theme.brand.website}/branches/bole`,
|
|
}: PrescriptionReadyEmailProps) => {
|
|
const l = resolveLocale(locale);
|
|
const t = tTemplate('prescription-ready', l);
|
|
const common = tCommon(l);
|
|
return (
|
|
<EmailLayout preview={interpolate(t.preview, { rxId })} locale={l}>
|
|
<StatusBanner tone="success">{t.banner}</StatusBanner>
|
|
<Heading style={styles.heading}>{t.heading}</Heading>
|
|
<Text style={styles.text}>{interpolate(t.body1, { userName, rxId, branchName })}</Text>
|
|
<Section style={styles.buttonSection}>
|
|
<Button href={ctaUrl}>{t.cta}</Button>
|
|
</Section>
|
|
<Text style={styles.muted}>{common.regards}<br />{common.team}</Text>
|
|
</EmailLayout>
|
|
);
|
|
};
|
|
|
|
PrescriptionReadyEmail.PreviewProps = { locale: 'en' } as PrescriptionReadyEmailProps;
|
|
export default PrescriptionReadyEmail;
|