@openlettermarketing/olc-react-sdk 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.cjs +18 -0
- package/.eslintrc.yml +47 -0
- package/.prettierignore +3 -0
- package/.prettierrc.yml +5 -0
- package/CHANGELOG.md +4 -0
- package/babel.config.json +10 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/examples/.eslintrc.yml +4 -0
- package/index.html +18 -0
- package/package.json +6 -6
- package/public/vite.svg +1 -0
- package/src/App.tsx +76 -0
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/input/cancel.tsx +20 -0
- package/src/assets/images/input/search.tsx +20 -0
- package/src/assets/images/modal-icons/cancelIcon.png +0 -0
- package/src/assets/images/modal-icons/del.tsx +19 -0
- package/src/assets/images/modal-icons/delete.svg +3 -0
- package/src/assets/images/modal-icons/modal-cross.tsx +23 -0
- package/src/assets/images/modal-icons/save.tsx +23 -0
- package/src/assets/images/templates/add-icon.svg +5 -0
- package/src/assets/images/templates/back-arrow.tsx +19 -0
- package/src/assets/images/templates/back-dialog-icon.png +0 -0
- package/src/assets/images/templates/back-dialog-icon.svg +3 -0
- package/src/assets/images/templates/barcode.png +0 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
- package/src/assets/images/templates/black-trash-icon.svg +3 -0
- package/src/assets/images/templates/cancel.svg +4 -0
- package/src/assets/images/templates/cancelIcon.png +0 -0
- package/src/assets/images/templates/clipboard.svg +3 -0
- package/src/assets/images/templates/contact-search.svg +3 -0
- package/src/assets/images/templates/content-copy-icon.tsx +24 -0
- package/src/assets/images/templates/cross.svg +3 -0
- package/src/assets/images/templates/custom-template-icon-black.svg +3 -0
- package/src/assets/images/templates/custom-template-icon.svg +3 -0
- package/src/assets/images/templates/custom-template.tsx +23 -0
- package/src/assets/images/templates/dummy-template.svg +21 -0
- package/src/assets/images/templates/dynamic-field.tsx +119 -0
- package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
- package/src/assets/images/templates/filter-2.svg +13 -0
- package/src/assets/images/templates/info-icon.svg +12 -0
- package/src/assets/images/templates/info-icon.tsx +37 -0
- package/src/assets/images/templates/one-barcode.png +0 -0
- package/src/assets/images/templates/personal-letter.tsx +53 -0
- package/src/assets/images/templates/plus-icon.svg +5 -0
- package/src/assets/images/templates/postcard.tsx +32 -0
- package/src/assets/images/templates/professional-letter.tsx +53 -0
- package/src/assets/images/templates/real-penned-letters.tsx +57 -0
- package/src/assets/images/templates/search.svg +3 -0
- package/src/assets/images/templates/size-image-lg.tsx +20 -0
- package/src/assets/images/templates/size-image-mid.tsx +20 -0
- package/src/assets/images/templates/size-image.tsx +20 -0
- package/src/assets/images/templates/template-copy.svg +3 -0
- package/src/assets/images/templates/template-default-design.tsx +21 -0
- package/src/assets/images/templates/template-delete.svg +3 -0
- package/src/assets/images/templates/template-edit.svg +4 -0
- package/src/assets/images/templates/template-save-icon.svg +3 -0
- package/src/assets/images/templates/template-search-2.svg +9 -0
- package/src/assets/images/templates/template-search.svg +4 -0
- package/src/assets/images/templates/thumbnail.svg +10 -0
- package/src/assets/images/templates/trash-icon.svg +13 -0
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
- package/src/components/CreateTemplate/index.tsx +377 -0
- package/src/components/CreateTemplate/styles.scss +363 -0
- package/src/components/GenericUIBlocks/Button/index.tsx +21 -0
- package/src/components/GenericUIBlocks/Button/styles.scss +15 -0
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +98 -0
- package/src/components/GenericUIBlocks/Dialog/index.tsx +127 -0
- package/src/components/GenericUIBlocks/Dialog/styles.scss +106 -0
- package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
- package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +86 -0
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +77 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +24 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +9 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +53 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +34 -0
- package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
- package/src/components/GenericUIBlocks/Input/index.tsx +89 -0
- package/src/components/GenericUIBlocks/Input/styles.scss +80 -0
- package/src/components/GenericUIBlocks/Snackbar/index.tsx +66 -0
- package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
- package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
- package/src/components/SidePanel/customFields/customFieldSection.tsx +162 -0
- package/src/components/SidePanel/customFields/styles.scss +47 -0
- package/src/components/SidePanel/index.tsx +30 -0
- package/src/components/SidePanel/templates/customTemplateSection.tsx +505 -0
- package/src/components/SidePanel/templates/styles.scss +151 -0
- package/src/components/TemplateBuilder/index.tsx +295 -0
- package/src/components/TemplateBuilder/styles.scss +66 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +58 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +98 -0
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +60 -0
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
- package/src/components/TopNavigation/index.tsx +388 -0
- package/src/components/TopNavigation/styles.scss +83 -0
- package/src/importMeta.d.ts +9 -0
- package/src/index.scss +130 -0
- package/src/index.tsx +82 -0
- package/src/libs/test.ts +7 -0
- package/src/redux/actions/action-types.ts +42 -0
- package/src/redux/actions/customFieldAction.ts +28 -0
- package/src/redux/actions/snackbarActions.ts +16 -0
- package/src/redux/actions/templateActions.ts +456 -0
- package/src/redux/reducers/customFieldReducer.ts +97 -0
- package/src/redux/reducers/index.ts +14 -0
- package/src/redux/reducers/snackbarReducer.ts +41 -0
- package/src/redux/reducers/templateReducer.ts +353 -0
- package/src/redux/store.ts +18 -0
- package/src/styles/colors.scss +61 -0
- package/src/test/mocks.js +89 -0
- package/src/test/setupJest.js +1 -0
- package/src/utils/api.ts +36 -0
- package/src/utils/constants.ts +40 -0
- package/src/utils/customStyles.ts +135 -0
- package/src/utils/fetchWrapper.ts +68 -0
- package/src/utils/fonts.json +1597 -0
- package/src/utils/helper.ts +19 -0
- package/src/utils/local-storage.ts +15 -0
- package/src/utils/message.ts +71 -0
- package/src/utils/template-builder.ts +147 -0
- package/src/utils/templateRestrictedArea/biFold.ts +433 -0
- package/src/utils/templateRestrictedArea/postCard.ts +439 -0
- package/src/utils/templateRestrictedArea/professional.ts +422 -0
- package/src/utils/templateRestrictedArea/realPenned.ts +283 -0
- package/src/utils/templateRestrictedArea/triFold.ts +434 -0
- package/tsconfig.json +29 -0
- package/tsconfig.node.json +12 -0
- package/vite.config.ts +8 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
@mixin errorField() {
|
|
2
|
+
font-size: 14px;
|
|
3
|
+
font-weight: 400;
|
|
4
|
+
color: var(--red);
|
|
5
|
+
line-height: 16.94px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.createTemplateMaindiv {
|
|
9
|
+
.createTemplateMainBox {
|
|
10
|
+
position: relative;
|
|
11
|
+
height: 100%;
|
|
12
|
+
|
|
13
|
+
.tempTypeRadioWrapper {
|
|
14
|
+
padding: 20px 0px 30px 0px;
|
|
15
|
+
border-left: none;
|
|
16
|
+
border-right: none;
|
|
17
|
+
margin-left: 40px;
|
|
18
|
+
|
|
19
|
+
.tempTypeRadioHeading {
|
|
20
|
+
p {
|
|
21
|
+
color: var(--textColor);
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
line-height: normal;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.tempTypeRadioBox {
|
|
30
|
+
margin-top: 20px;
|
|
31
|
+
margin-bottom: 10px;
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: flex-start;
|
|
34
|
+
align-items: flex-start;
|
|
35
|
+
gap: 25px;
|
|
36
|
+
|
|
37
|
+
.tempRadio {
|
|
38
|
+
input {
|
|
39
|
+
&:checked {
|
|
40
|
+
accent-color: var(--primaryColor);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:focus {
|
|
44
|
+
outline: none !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
label {
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
color: var(--textColor);
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
line-height: normal;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
& .error-field {
|
|
62
|
+
@include errorField;
|
|
63
|
+
margin-left: 5px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.createTemplateHeader {
|
|
68
|
+
padding-bottom: 15px;
|
|
69
|
+
margin-left: 40px;
|
|
70
|
+
|
|
71
|
+
p {
|
|
72
|
+
color: var(--primaryColor);
|
|
73
|
+
font-size: 24px;
|
|
74
|
+
font-style: normal;
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
line-height: normal;
|
|
77
|
+
margin-bottom: 20px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.templateInputWrapper {
|
|
81
|
+
p {
|
|
82
|
+
color: var(--textColor);
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
font-style: normal;
|
|
85
|
+
font-weight: 500;
|
|
86
|
+
line-height: normal;
|
|
87
|
+
margin-bottom: 16px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
& .error-field {
|
|
91
|
+
@include errorField;
|
|
92
|
+
margin-top: 10px !important;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.templateSelectWrapper {
|
|
98
|
+
padding-bottom: 15px;
|
|
99
|
+
margin: 20px 0px 0px 40px;
|
|
100
|
+
p {
|
|
101
|
+
color: var(--textColor);
|
|
102
|
+
font-size: 14px;
|
|
103
|
+
font-style: normal;
|
|
104
|
+
font-weight: 500;
|
|
105
|
+
line-height: normal;
|
|
106
|
+
margin-bottom: 16px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
& .error-field {
|
|
110
|
+
@include errorField;
|
|
111
|
+
margin-top: 10px !important;
|
|
112
|
+
font-weight: 400;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
.productTypeWrapper {
|
|
118
|
+
padding: 20px 0px;
|
|
119
|
+
margin-left: 40px;
|
|
120
|
+
|
|
121
|
+
.productHeading {
|
|
122
|
+
p {
|
|
123
|
+
&:first-child {
|
|
124
|
+
color: var(--textColor);
|
|
125
|
+
font-size: 14px;
|
|
126
|
+
font-style: normal;
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
line-height: normal;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:last-child {
|
|
132
|
+
color: var(--primaryColor);
|
|
133
|
+
font-size: 10px;
|
|
134
|
+
font-style: normal;
|
|
135
|
+
font-weight: 400;
|
|
136
|
+
line-height: 18px;
|
|
137
|
+
text-decoration-line: underline;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.productsWrapper {
|
|
143
|
+
margin-top: 20px;
|
|
144
|
+
display: flex;
|
|
145
|
+
justify-content: flex-start;
|
|
146
|
+
align-items: center;
|
|
147
|
+
gap: 25px;
|
|
148
|
+
|
|
149
|
+
.productCard {
|
|
150
|
+
display: flex;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
align-items: center;
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
border-radius: 6.299px;
|
|
155
|
+
border: 0.45px solid var(--borderColor);
|
|
156
|
+
background: var(--productCardBgColor);
|
|
157
|
+
width: 100%;
|
|
158
|
+
max-width: 185px;
|
|
159
|
+
height: 100%;
|
|
160
|
+
min-height: 135px;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
transition: 0.1s ease-in all;
|
|
163
|
+
gap: 17px;
|
|
164
|
+
|
|
165
|
+
&.active,
|
|
166
|
+
&:hover {
|
|
167
|
+
background: var(--productCardBackgroundColorActive);
|
|
168
|
+
border-color: var(--primaryColor);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
p {
|
|
172
|
+
color: var(--primaryColor);
|
|
173
|
+
font-size: 16px;
|
|
174
|
+
font-style: normal;
|
|
175
|
+
font-weight: 600;
|
|
176
|
+
line-height: normal;
|
|
177
|
+
margin: 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&:last-child {
|
|
181
|
+
img {
|
|
182
|
+
margin-bottom: 5px !important;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&.error {
|
|
187
|
+
border: 0.45px solid var(--red);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
& .error-field {
|
|
193
|
+
margin-top: 10px;
|
|
194
|
+
@include errorField;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.postCardSizeWrapper {
|
|
199
|
+
padding: 20px 0px;
|
|
200
|
+
margin: 0px 0px 80px 40px;
|
|
201
|
+
|
|
202
|
+
.postCardHeading {
|
|
203
|
+
p {
|
|
204
|
+
color: var(--textColor);
|
|
205
|
+
font-size: 14px;
|
|
206
|
+
font-style: normal;
|
|
207
|
+
font-weight: 500;
|
|
208
|
+
line-height: normal;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.postCardWrapper {
|
|
213
|
+
margin-top: 20px;
|
|
214
|
+
display: flex;
|
|
215
|
+
justify-content: flex-start;
|
|
216
|
+
align-items: flex-start;
|
|
217
|
+
gap: 25px;
|
|
218
|
+
|
|
219
|
+
.postCard {
|
|
220
|
+
display: flex;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
align-items: center;
|
|
223
|
+
gap: 20px;
|
|
224
|
+
flex-direction: column;
|
|
225
|
+
border-radius: 6.299px;
|
|
226
|
+
border: 0.45px solid var(--borderColor);
|
|
227
|
+
background: var(--postCardBgColor);
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
padding: 13px 20px;
|
|
230
|
+
transition: 0.1s ease-in all;
|
|
231
|
+
|
|
232
|
+
svg {
|
|
233
|
+
&:nth-child(2) {
|
|
234
|
+
margin-bottom: 20px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&:last-child {
|
|
238
|
+
margin-bottom: 20px;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
svg {
|
|
243
|
+
path {
|
|
244
|
+
fill: var(--postCardSVGColor);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
&.active,
|
|
249
|
+
&:hover {
|
|
250
|
+
background: var(--postCardBackgroundColorActive);
|
|
251
|
+
border-color: var(--primaryColor);
|
|
252
|
+
|
|
253
|
+
svg {
|
|
254
|
+
&:nth-child(2) {
|
|
255
|
+
margin-bottom: 20px;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&:last-child {
|
|
259
|
+
margin-bottom: 20px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
path {
|
|
263
|
+
fill: var(--svgColor);
|
|
264
|
+
|
|
265
|
+
&:hover {
|
|
266
|
+
fill: var(--svgColor);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
p {
|
|
273
|
+
color: var(--primaryColor);
|
|
274
|
+
font-size: 16px;
|
|
275
|
+
font-style: normal;
|
|
276
|
+
font-weight: 600;
|
|
277
|
+
line-height: normal;
|
|
278
|
+
margin: 0;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.postCard-small {
|
|
283
|
+
width: 100%;
|
|
284
|
+
max-width: 150px;
|
|
285
|
+
height: 100%;
|
|
286
|
+
min-height: 148px;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.postCard-mid {
|
|
290
|
+
width: 100%;
|
|
291
|
+
max-width: 196px;
|
|
292
|
+
height: 100%;
|
|
293
|
+
min-height: 182px;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.postCard-large {
|
|
297
|
+
width: 100%;
|
|
298
|
+
max-width: 248px;
|
|
299
|
+
height: 100%;
|
|
300
|
+
min-height: 226px;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
& .error-field {
|
|
305
|
+
margin-top: 10px;
|
|
306
|
+
@include errorField;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.footerBtns {
|
|
311
|
+
position: fixed;
|
|
312
|
+
width: 100%;
|
|
313
|
+
bottom: 0;
|
|
314
|
+
border-top: 0.5px solid var(--borderColor);
|
|
315
|
+
background-color: var(--footerBgColor);
|
|
316
|
+
|
|
317
|
+
.createTemplateBtns {
|
|
318
|
+
display: flex;
|
|
319
|
+
justify-content: flex-end;
|
|
320
|
+
align-items: center;
|
|
321
|
+
gap: 20px;
|
|
322
|
+
padding: 14px 95px 14px 35px;
|
|
323
|
+
|
|
324
|
+
button {
|
|
325
|
+
width: 100%;
|
|
326
|
+
max-width: 100px;
|
|
327
|
+
height: 100%;
|
|
328
|
+
min-height: 40px;
|
|
329
|
+
text-transform: capitalize;
|
|
330
|
+
border-radius: 3px;
|
|
331
|
+
|
|
332
|
+
&:first-child {
|
|
333
|
+
color: var(--secondaryButtonTextColor);
|
|
334
|
+
text-align: center;
|
|
335
|
+
font-size: 14px;
|
|
336
|
+
font-style: normal;
|
|
337
|
+
font-weight: 600;
|
|
338
|
+
line-height: normal;
|
|
339
|
+
border: 0.5px solid var(--borderColor);
|
|
340
|
+
background-color: var(--secondaryButtonBgColor);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
&:last-child {
|
|
344
|
+
color: var(--primaryButtonTextColor);
|
|
345
|
+
text-align: center;
|
|
346
|
+
font-size: 14px;
|
|
347
|
+
font-style: normal;
|
|
348
|
+
font-weight: 600;
|
|
349
|
+
line-height: normal;
|
|
350
|
+
background-color: var(--primaryButtonBgColor);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.mb-5 {
|
|
358
|
+
margin-bottom: 6rem !important;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.error {
|
|
362
|
+
border: 1.5px solid var(--red);
|
|
363
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { CSSProperties, ReactNode, MouseEventHandler } from 'react';
|
|
2
|
+
|
|
3
|
+
// styles
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
|
|
6
|
+
interface ButtonProps {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Button: React.FC<ButtonProps> = ({ children = '', style = {}, onClick, className = '' }) => {
|
|
14
|
+
return (
|
|
15
|
+
<div className={`basic-button ${className}`} onClick={onClick} style={style}>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default Button;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.basic-button {
|
|
2
|
+
background-color: var(--primaryColor);
|
|
3
|
+
color: white;
|
|
4
|
+
width: 100%;
|
|
5
|
+
max-width: fit-content;
|
|
6
|
+
padding: 0px 10px;
|
|
7
|
+
font-size: 16px;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
height: 100%;
|
|
10
|
+
border-radius: 4px;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useState, useEffect, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
// styles
|
|
4
|
+
import './styles.scss';
|
|
5
|
+
|
|
6
|
+
interface CircularProgressProps {
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const CircularProgress: React.FC<CircularProgressProps> = ({ style = {} }) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className={'basic-progress'}>
|
|
13
|
+
<div className="loader" style={style} />
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default CircularProgress;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
.basic-progress {
|
|
2
|
+
.loader {
|
|
3
|
+
width: 50px;
|
|
4
|
+
aspect-ratio: 1;
|
|
5
|
+
border-radius: 50%;
|
|
6
|
+
animation: l20-1 0.8s infinite linear alternate, l20-2 1.6s infinite linear;
|
|
7
|
+
}
|
|
8
|
+
@keyframes l20-1 {
|
|
9
|
+
0% {
|
|
10
|
+
clip-path: polygon(50% 50%, 0 0, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%);
|
|
11
|
+
}
|
|
12
|
+
12.5% {
|
|
13
|
+
clip-path: polygon(
|
|
14
|
+
50% 50%,
|
|
15
|
+
0 0,
|
|
16
|
+
50% 0%,
|
|
17
|
+
100% 0%,
|
|
18
|
+
100% 0%,
|
|
19
|
+
100% 0%,
|
|
20
|
+
100% 0%
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
25% {
|
|
24
|
+
clip-path: polygon(
|
|
25
|
+
50% 50%,
|
|
26
|
+
0 0,
|
|
27
|
+
50% 0%,
|
|
28
|
+
100% 0%,
|
|
29
|
+
100% 100%,
|
|
30
|
+
100% 100%,
|
|
31
|
+
100% 100%
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
50% {
|
|
35
|
+
clip-path: polygon(
|
|
36
|
+
50% 50%,
|
|
37
|
+
0 0,
|
|
38
|
+
50% 0%,
|
|
39
|
+
100% 0%,
|
|
40
|
+
100% 100%,
|
|
41
|
+
50% 100%,
|
|
42
|
+
0% 100%
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
62.5% {
|
|
46
|
+
clip-path: polygon(
|
|
47
|
+
50% 50%,
|
|
48
|
+
100% 0,
|
|
49
|
+
100% 0%,
|
|
50
|
+
100% 0%,
|
|
51
|
+
100% 100%,
|
|
52
|
+
50% 100%,
|
|
53
|
+
0% 100%
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
75% {
|
|
57
|
+
clip-path: polygon(
|
|
58
|
+
50% 50%,
|
|
59
|
+
100% 100%,
|
|
60
|
+
100% 100%,
|
|
61
|
+
100% 100%,
|
|
62
|
+
100% 100%,
|
|
63
|
+
50% 100%,
|
|
64
|
+
0% 100%
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
100% {
|
|
68
|
+
clip-path: polygon(
|
|
69
|
+
50% 50%,
|
|
70
|
+
50% 100%,
|
|
71
|
+
50% 100%,
|
|
72
|
+
50% 100%,
|
|
73
|
+
50% 100%,
|
|
74
|
+
50% 100%,
|
|
75
|
+
0% 100%
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
@keyframes l20-2 {
|
|
80
|
+
0% {
|
|
81
|
+
transform: scaleY(1) rotate(0deg);
|
|
82
|
+
}
|
|
83
|
+
49.99% {
|
|
84
|
+
transform: scaleY(1) rotate(135deg);
|
|
85
|
+
}
|
|
86
|
+
50% {
|
|
87
|
+
transform: scaleY(-1) rotate(0deg);
|
|
88
|
+
}
|
|
89
|
+
100% {
|
|
90
|
+
transform: scaleY(-1) rotate(-135deg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.hide-loader {
|
|
94
|
+
.loader {
|
|
95
|
+
display: none !important; /* Hide the pseudo-element */
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
// components
|
|
4
|
+
import Button from '../Button';
|
|
5
|
+
import Typography from '../Typography';
|
|
6
|
+
import CircularProgress from '../CircularProgress';
|
|
7
|
+
|
|
8
|
+
// styles
|
|
9
|
+
import './styles.scss';
|
|
10
|
+
|
|
11
|
+
interface DialogProps {
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
customStyles?: CSSProperties;
|
|
14
|
+
open: boolean;
|
|
15
|
+
handleClose: () => void;
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
title?: string;
|
|
18
|
+
subHeading?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
onSubmit?: () => void;
|
|
21
|
+
onCancel?: () => void;
|
|
22
|
+
cancelText?: string;
|
|
23
|
+
submitText?: string;
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const buttonStyles: CSSProperties = {
|
|
28
|
+
color: 'var(--primaryButtonTextColor)',
|
|
29
|
+
backgroundColor: 'var(--primaryButtonBgColor)',
|
|
30
|
+
maxWidth: '100px',
|
|
31
|
+
minHeight: '40px',
|
|
32
|
+
border: '0.5px solid var(--borderColor)',
|
|
33
|
+
fontSize: '14px',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const heading: CSSProperties = {
|
|
37
|
+
fontSize: '22px',
|
|
38
|
+
color: 'var(--dialogModalHeadingColor)',
|
|
39
|
+
fontWeight: '700',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const subHeadingStyle: CSSProperties = {
|
|
43
|
+
fontSize: '16px',
|
|
44
|
+
color: 'var(--dialogModalTextColor',
|
|
45
|
+
fontWeight: '700',
|
|
46
|
+
textAlign: 'center',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const progressStyles: CSSProperties = {
|
|
50
|
+
width: '20px',
|
|
51
|
+
height: '20px',
|
|
52
|
+
border: '2px solid #fff',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const Dialog: React.FC<DialogProps> = ({
|
|
56
|
+
icon = null,
|
|
57
|
+
customStyles = {},
|
|
58
|
+
open,
|
|
59
|
+
handleClose,
|
|
60
|
+
loading = false,
|
|
61
|
+
title = "",
|
|
62
|
+
subHeading = "",
|
|
63
|
+
description = "",
|
|
64
|
+
onSubmit,
|
|
65
|
+
onCancel,
|
|
66
|
+
cancelText = "",
|
|
67
|
+
submitText = "",
|
|
68
|
+
children = [],
|
|
69
|
+
}) => {
|
|
70
|
+
const contentAdjust = submitText.length > 6 ? "fit-content" : "100px";
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
id="myModal"
|
|
75
|
+
className="modal"
|
|
76
|
+
style={{display: open ? 'flex' : 'none'}}
|
|
77
|
+
>
|
|
78
|
+
<div className="modal-content" style={customStyles}>
|
|
79
|
+
<div className="modal-header">
|
|
80
|
+
<span className="close" onClick={handleClose}>
|
|
81
|
+
×
|
|
82
|
+
</span>
|
|
83
|
+
</div>
|
|
84
|
+
<div className="modal-body">
|
|
85
|
+
<div className="modal-icon">{icon}</div>
|
|
86
|
+
<Typography variant="p" style={heading}>
|
|
87
|
+
{title}
|
|
88
|
+
</Typography>
|
|
89
|
+
{subHeading && (
|
|
90
|
+
<Typography variant="p" style={subHeadingStyle}>
|
|
91
|
+
{subHeading}
|
|
92
|
+
</Typography>
|
|
93
|
+
)}
|
|
94
|
+
{description && (
|
|
95
|
+
<Typography
|
|
96
|
+
variant="p"
|
|
97
|
+
style={{...subHeadingStyle, fontWeight: '400'}}
|
|
98
|
+
>
|
|
99
|
+
{description}
|
|
100
|
+
</Typography>
|
|
101
|
+
)}
|
|
102
|
+
{children}
|
|
103
|
+
</div>
|
|
104
|
+
<div className="modal-footer">
|
|
105
|
+
<Button
|
|
106
|
+
onClick={onCancel}
|
|
107
|
+
style={{
|
|
108
|
+
...buttonStyles,
|
|
109
|
+
color: 'var(--secondaryButtonTextColor)',
|
|
110
|
+
backgroundColor: 'var(--secondaryButtonBgColor)',
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{cancelText}
|
|
114
|
+
</Button>
|
|
115
|
+
<Button
|
|
116
|
+
style={{...buttonStyles, border: 'none', maxWidth: contentAdjust}}
|
|
117
|
+
onClick={onSubmit}
|
|
118
|
+
>
|
|
119
|
+
{loading ? <CircularProgress style={progressStyles} /> : submitText}
|
|
120
|
+
</Button>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default Dialog;
|