-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmailPreviewPanel.tsx
More file actions
80 lines (72 loc) · 2.38 KB
/
EmailPreviewPanel.tsx
File metadata and controls
80 lines (72 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import type { EmailTabId, EmailsState, Signature } from './types';
import { buildSignatureHTML } from './types';
interface EmailPreviewPanelProps {
activeTab: EmailTabId;
emails: EmailsState;
sig: Signature;
ctaText: string;
headerImageUrl: string;
}
export default function EmailPreviewPanel({
activeTab,
emails,
sig,
ctaText,
headerImageUrl,
}: EmailPreviewPanelProps) {
const email = emails[activeTab];
return (
<div className="flex flex-col gap-5 h-full">
<p className="text-xs font-semibold text-slate-400 uppercase tracking-widest">
Email Preview
</p>
<div className="bg-white shadow-lg border border-slate-100 overflow-hidden">
{headerImageUrl ? (
<div className="w-full h-[120px] overflow-hidden">
<img
src={headerImageUrl}
alt="Email header"
className="w-full h-full object-cover"
/>
</div>
) : (
<div className="bg-gradient-to-r from-indigo-600 to-violet-500 px-8 py-5 flex items-center gap-3">
<svg
viewBox="0 0 24 24"
fill="none"
className="w-7 h-7 text-white"
stroke="currentColor"
strokeWidth="1.8"
>
<path
d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
<span className="text-white font-semibold text-lg tracking-wide">
{sig.company || 'Your Organization'}
</span>
</div>
)}
<div className="px-8 py-6">
<div
className="prose prose-sm max-w-none text-slate-700 leading-relaxed mb-6"
dangerouslySetInnerHTML={{ __html: email.body }}
/>
{ctaText && (
<div className="mb-8 text-center">
<button className="bg-indigo-600 text-white px-8 py-3.5 rounded-xl font-bold tracking-wide text-sm shadow-lg shadow-indigo-100 uppercase">
{ctaText}
</button>
</div>
)}
<div
className="border-t border-slate-100 pt-6"
dangerouslySetInnerHTML={{ __html: buildSignatureHTML(sig) }}
/>
</div>
</div>
</div>
);
}