-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathweekly-sales.tsx
201 lines (174 loc) · 5.84 KB
/
weekly-sales.tsx
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import {
Body,
Container,
Head,
Heading,
Html,
Img,
Preview,
Section,
Text,
Link,
Row,
Column,
} from "@react-email/components";
import * as React from "react";
interface WeeklySalesEmailProps {
items?: { imgSrc: string; price: string }[];
storeLink: string;
}
export const WeeklySalesEmail = ({ items = [], storeLink }: WeeklySalesEmailProps) => (
<Html>
<Head />
<Preview>Weekly Specials Just for You!</Preview>
<Body style={main}>
<Container style={container}>
<Heading style={heading}>Weekly Specials Just for You!</Heading>
<Container style={gridStyle}>
<Section>
<Row style={rowStyle}>
{items.slice(0, 3).map((item, index) => (
<Column key={index} style={columnStyle}>
<Img
src={item.imgSrc}
alt={`Sale item ${index + 1}`}
style={imageStyle}
/>
<Text style={priceStyle}>Price: ${item.price}</Text>
</Column>
))}
</Row>
</Section>
<Section>
<Row style={rowStyle}>
{items.slice(3, 6).map((item, index) => (
<Column key={index + 3} style={columnStyle}>
<Img
src={item.imgSrc}
alt={`Sale item ${index + 4}`}
style={imageStyle}
/>
<Text style={priceStyle}>Price: ${item.price}</Text>
</Column>
))}
</Row>
</Section>
</Container>
<Section style={buttonContainer}>
<Link href={storeLink} style={storeButtonStyle}>
Grab These Deals Today!
</Link>
<Text style={h2}>
Hurry, These Deals Won't Last!
</Text>
<Text style={links}>
<Link style={link} href="#">Browse our full selection</Link> ・{" "}
<Link style={link} href="#">Need help? Contact us!</Link>
</Text>
<Text style={footer}>
Business Inc. ・123 Business St ・City, Country 12345
</Text>
</Section>
</Container>
</Body>
</Html>
);
WeeklySalesEmail.PreviewProps = {
items: [
{ imgSrc: "https://images.pexels.com/photos/128598/pexels-photo-128598.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", price: "20.56" },
{ imgSrc: "https://images.pexels.com/photos/2363347/pexels-photo-2363347.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", price: "30.90" },
{ imgSrc: "https://images.pexels.com/photos/70746/strawberries-red-fruit-royalty-free-70746.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", price: "7.50" },
{ imgSrc: "https://images.pexels.com/photos/760281/pexels-photo-760281.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", price: "12.90" },
{ imgSrc: "https://images.pexels.com/photos/51958/oranges-fruit-vitamins-healthy-eating-51958.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", price: "10.36" },
{ imgSrc: "https://images.pexels.com/photos/693794/pexels-photo-693794.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1", price: "15.20" },
],
storeLink: "https://store.com",
} as WeeklySalesEmailProps;
const gridStyle = {
background: "rgb(245, 244, 245)",
borderRadius: "4px",
marginBottom: "30px",
padding: "5px 5px",
};
const rowStyle = {
display: 'flex',
justifyContent: 'space-between',
flexWrap: 'wrap' as const,
margin: '10px 0',
};
const columnStyle = {
width: '32%',
textAlign: 'center' as const,
margin: '10px',
padding: '8px',
};
const imageStyle = {
width: '100%',
maxWidth: '180px',
height: 'auto',
aspectRatio: '1 / 1',
objectFit: 'cover' as const,
borderRadius: '5px',
};
const priceStyle = {
fontWeight: 'bold',
marginTop: '5px',
fontSize: "18px",
};
const main = {
backgroundColor: "#ffffff",
fontFamily:
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',
};
const container = {
margin: "0 auto",
padding: "20px",
maxWidth: "600px",
};
const heading = {
fontSize: "36px",
lineHeight: "1.4",
fontWeight: "700",
color: "#ff0000",
textAlign: "center" as const,
marginBottom: "20px",
};
const h2 = {
fontSize: "28px",
lineHeight: "1.4",
fontWeight: "700",
color: "#ff0000",
textAlign: "center" as const,
marginBottom: "20px",
};
const buttonContainer = {
textAlign: "center" as const,
marginTop: "20px",
};
const storeButtonStyle = {
display: "inline-block",
padding: "15px 30px",
backgroundColor: "#ff0000",
color: "#ffffff",
textDecoration: "none",
fontWeight: "bold",
borderRadius: "5px",
fontSize: "16px",
};
const links = {
textAlign: "center" as const,
};
const link = {
color: "#0366d6",
fontSize: "12px",
textDecoration: "underline",
};
const footer = {
color: "#6a737d",
fontSize: "12px",
textAlign: "center" as const,
marginTop: "40px",
borderTop: "1px solid #dedede",
paddingTop: "20px",
};
export default WeeklySalesEmail;