@antscorp/antsomi-ui 1.3.5-beta.17 → 1.3.5-beta.18
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/es/components/atoms/Spin/Spin.js +2 -2
- package/es/components/common/ConfigProvider/GlobalStyle.js +75 -15
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +20 -16
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +3 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +23 -0
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +1 -1
- package/es/components/molecules/ModalV2/styled.js +4 -0
- package/es/components/molecules/ThumbnailCard/constants.d.ts +2 -2
- package/es/components/molecules/ThumbnailCard/constants.js +2 -2
- package/es/components/organism/PreviewTemplateModal/components/Banner/index.d.ts +1 -4
- package/es/components/organism/PreviewTemplateModal/components/Banner/index.js +4 -3
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.d.ts +1 -0
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +28 -21
- package/es/components/organism/PreviewTemplateModal/components/Information/index.js +13 -13
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +11 -0
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/index.js +15 -1
- package/es/components/organism/PreviewTemplateModal/constants/defaultProps.d.ts +5 -0
- package/es/components/organism/PreviewTemplateModal/constants/defaultProps.js +8 -0
- package/es/components/organism/PreviewTemplateModal/index.js +11 -10
- package/es/components/organism/PreviewTemplateModal/styled.js +2 -2
- package/es/components/organism/PreviewTemplateModal/types.d.ts +9 -3
- package/es/components/template/TemplateListing/Loadable.d.ts +6 -0
- package/es/components/template/TemplateListing/Loadable.js +7 -0
- package/es/components/template/TemplateListing/components/BlankTemplate/index.js +3 -1
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +4 -3
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +5 -0
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +2 -3
- package/es/components/template/TemplateListing/constants/defaultProps.js +3 -6
- package/es/components/template/TemplateListing/hooks/useTemplateListing.d.ts +17 -3
- package/es/components/template/TemplateListing/hooks/useTemplateListing.js +52 -13
- package/es/components/template/TemplateListing/index.js +51 -12
- package/es/components/template/TemplateListing/styled/index.js +2 -4
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +2 -1
- package/es/components/template/TemplateListing/types/TemplateListing.d.ts +14 -7
- package/es/components/template/index.d.ts +1 -1
- package/es/components/template/index.js +1 -1
- package/es/constants/datetime.d.ts +8 -0
- package/es/constants/datetime.js +1594 -0
- package/es/constants/index.d.ts +4 -1
- package/es/constants/index.js +4 -1
- package/es/constants/queries.d.ts +1 -0
- package/es/constants/queries.js +1 -0
- package/es/constants/templateListing.d.ts +42 -0
- package/es/constants/templateListing.js +42 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/models/ObjectTemplate.d.ts +40 -15
- package/es/models/ObjectTemplate.js +80 -28
- package/es/queries/TemplateListing/index.d.ts +30 -2
- package/es/queries/TemplateListing/index.js +50 -0
- package/es/queries/index.d.ts +1 -0
- package/es/queries/index.js +1 -0
- package/es/services/TemplateListing/index.d.ts +41 -12
- package/es/services/TemplateListing/index.js +93 -13
- package/es/test.js +6 -6
- package/es/types/index.d.ts +2 -0
- package/es/types/index.js +1 -0
- package/es/types/service.d.ts +5 -0
- package/es/types/templateListing.d.ts +2 -1
- package/package.json +1 -1
|
@@ -19,10 +19,10 @@ import { StyledSpin } from './styled';
|
|
|
19
19
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
20
20
|
export const Spin = (props) => {
|
|
21
21
|
var _a;
|
|
22
|
-
const { indicatorSize } = props, restOf = __rest(props, ["indicatorSize"]);
|
|
22
|
+
const { indicatorSize, children } = props, restOf = __rest(props, ["indicatorSize", "children"]);
|
|
23
23
|
return (React.createElement(StyledSpin, Object.assign({}, Object.assign({ indicator: (React.createElement(LoadingOutlined, { style: {
|
|
24
24
|
fontSize: indicatorSize || 30,
|
|
25
25
|
color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorPrimary,
|
|
26
|
-
}, spin: true })) }, restOf)),
|
|
26
|
+
}, spin: true })) }, restOf)), children));
|
|
27
27
|
};
|
|
28
28
|
Spin.defaultProps = {};
|
|
@@ -291,25 +291,24 @@ export const GlobalStyle = () => {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
-
.antsomi-picker-date-panel {
|
|
294
|
+
/* .antsomi-picker-date-panel {
|
|
295
295
|
position: relative;
|
|
296
|
-
}
|
|
296
|
+
} */
|
|
297
297
|
|
|
298
|
-
.antsomi-picker-date-panel::before {
|
|
298
|
+
/* .antsomi-picker-date-panel::before {
|
|
299
299
|
content: 'Hours';
|
|
300
300
|
position: absolute;
|
|
301
301
|
top: 0;
|
|
302
302
|
right: 0;
|
|
303
303
|
transform: translateX(100%);
|
|
304
304
|
width: 61px;
|
|
305
|
-
/* width: 53.5px; */
|
|
306
305
|
font-weight: bold;
|
|
307
306
|
border-right: 1px solid rgba(5, 5, 5, 0.06);
|
|
308
307
|
height: 38px;
|
|
309
308
|
display: flex;
|
|
310
309
|
align-items: center;
|
|
311
310
|
justify-content: center;
|
|
312
|
-
}
|
|
311
|
+
} */
|
|
313
312
|
|
|
314
313
|
.antsomi-picker-time-panel {
|
|
315
314
|
.antsomi-picker-time-panel-column:after {
|
|
@@ -336,43 +335,94 @@ export const GlobalStyle = () => {
|
|
|
336
335
|
display: none;
|
|
337
336
|
}
|
|
338
337
|
|
|
339
|
-
.antsomi-picker-
|
|
338
|
+
.antsomi-picker-time-panel-column {
|
|
339
|
+
width: 60px;
|
|
340
|
+
margin-top: 38px;
|
|
341
|
+
/* margin-top: 0; */
|
|
342
|
+
scrollbar-width: unset;
|
|
343
|
+
scrollbar-color: unset;
|
|
344
|
+
|
|
345
|
+
&::-webkit-scrollbar {
|
|
346
|
+
width: 6px;
|
|
347
|
+
background: transparent;
|
|
348
|
+
}
|
|
349
|
+
&::-webkit-scrollbar-track {
|
|
350
|
+
/* margin-top: 38px; */
|
|
351
|
+
border-radius: 10px;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/* ul.antsomi-picker-time-panel-column::before {
|
|
356
|
+
content: '';
|
|
357
|
+
position: absolute;
|
|
358
|
+
background: red;
|
|
359
|
+
top: 0;
|
|
360
|
+
right: 0;
|
|
361
|
+
width: 1px;
|
|
362
|
+
bottom: 0;
|
|
363
|
+
} */
|
|
364
|
+
|
|
365
|
+
/* .antsomi-picker-time-panel-column::before {
|
|
366
|
+
content: 'Hours';
|
|
367
|
+
position: sticky;
|
|
368
|
+
display: block;
|
|
369
|
+
top: 0;
|
|
370
|
+
height: 38px;
|
|
371
|
+
line-height: 38px;
|
|
372
|
+
text-align: center;
|
|
373
|
+
font-weight: bold;
|
|
374
|
+
background-color: #fff;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.antsomi-picker-time-panel-column:nth-child(1)::before {
|
|
378
|
+
content: 'Hours';
|
|
379
|
+
}
|
|
380
|
+
.antsomi-picker-time-panel-column:nth-child(2)::before {
|
|
381
|
+
content: 'Minutes';
|
|
382
|
+
}
|
|
383
|
+
.antsomi-picker-time-panel-column:nth-child(3)::before {
|
|
384
|
+
content: 'Seconds';
|
|
385
|
+
} */
|
|
386
|
+
|
|
387
|
+
/* .antsomi-picker-content {
|
|
340
388
|
position: relative;
|
|
341
389
|
|
|
342
390
|
.antsomi-picker-time-panel-column {
|
|
343
391
|
margin-top: 38px;
|
|
344
392
|
width: 60px;
|
|
345
393
|
}
|
|
394
|
+
} */
|
|
395
|
+
|
|
396
|
+
.antsomi-picker-content {
|
|
397
|
+
position: relative;
|
|
346
398
|
}
|
|
347
399
|
|
|
348
|
-
.antsomi-picker-content::after,
|
|
400
|
+
/* .antsomi-picker-content::after,
|
|
349
401
|
.antsomi-picker-content::before {
|
|
350
402
|
content: 'Minutes';
|
|
351
403
|
position: absolute;
|
|
352
404
|
top: 0;
|
|
353
405
|
left: 61px;
|
|
354
|
-
/* left: 53.5px; */
|
|
355
406
|
width: 60px;
|
|
356
|
-
/* width: 52.5px; */
|
|
357
407
|
height: 38px;
|
|
358
408
|
display: flex;
|
|
359
409
|
align-items: center;
|
|
360
410
|
justify-content: center;
|
|
361
411
|
font-weight: bold;
|
|
362
|
-
}
|
|
412
|
+
} */
|
|
363
413
|
|
|
364
|
-
.antsomi-picker-content::before {
|
|
414
|
+
/* .antsomi-picker-content::before {
|
|
365
415
|
border-right: 1px solid rgba(5, 5, 5, 0.06);
|
|
366
|
-
}
|
|
367
|
-
.antsomi-picker-content::after {
|
|
416
|
+
} */
|
|
417
|
+
/* .antsomi-picker-content::after {
|
|
368
418
|
content: 'Seconds';
|
|
369
419
|
left: 120px;
|
|
370
|
-
}
|
|
420
|
+
} */
|
|
371
421
|
}
|
|
372
422
|
|
|
373
423
|
/* Custom css scrollbar */
|
|
374
424
|
ul {
|
|
375
|
-
padding-left:
|
|
425
|
+
padding-left: 6px;
|
|
376
426
|
scrollbar-gutter: stable;
|
|
377
427
|
}
|
|
378
428
|
}
|
|
@@ -415,6 +465,16 @@ export const GlobalStyle = () => {
|
|
|
415
465
|
content: 'Hours';
|
|
416
466
|
border: none;
|
|
417
467
|
left: 0;
|
|
468
|
+
|
|
469
|
+
position: absolute;
|
|
470
|
+
top: 0;
|
|
471
|
+
/* left: 61px; */
|
|
472
|
+
width: 60px;
|
|
473
|
+
height: 38px;
|
|
474
|
+
display: flex;
|
|
475
|
+
align-items: center;
|
|
476
|
+
justify-content: center;
|
|
477
|
+
font-weight: bold;
|
|
418
478
|
}
|
|
419
479
|
}
|
|
420
480
|
&.is-minutes-picker {
|
|
@@ -18,7 +18,7 @@ import { DropdownLabel } from '../DropdownLabel/DropdownLabel';
|
|
|
18
18
|
import { handleError, reorder } from '@antscorp/antsomi-ui/es/utils';
|
|
19
19
|
import { calculationDateAdvanced, getCellRender, getFormatDisplay, getPickerRender, getTimePickerRender, } from './utils';
|
|
20
20
|
// Styled
|
|
21
|
-
import { DatePickerCustomInput, DatePickerHeader, DropdownContent, DropdownHeader, DatePickerFooter, DropdownFooter, CalendarIconWrapper, InputStyled, } from './styled';
|
|
21
|
+
import { DatePickerCustomInput, DatePickerHeader, DropdownContent, DropdownHeader, DatePickerFooter, DropdownFooter, CalendarIconWrapper, InputStyled, TimeLabel, } from './styled';
|
|
22
22
|
// Constants
|
|
23
23
|
import { CALCULATION_DATES, CALCULATION_TYPES, DATE_TYPES, DEFAULT_DATE_FORMAT, VALUE_TYPES, ADVANCED_PICKER_TYPE, WEEK_ARR, QUARTER_PLACEHOLDER, WEEK_PLACEHOLDER, DAY_LABEL_SHORT, MONTH_LABEL_FULL, DAY_OF_MONTH, ANCHOR_LEAP_YEAR, GRANULARITY_MAPPING, } from './constants';
|
|
24
24
|
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
@@ -244,7 +244,8 @@ export const AdvancedPicker = props => {
|
|
|
244
244
|
};
|
|
245
245
|
const onClickNow = () => {
|
|
246
246
|
try {
|
|
247
|
-
|
|
247
|
+
const currentDate = dayjs();
|
|
248
|
+
setState(state => (Object.assign(Object.assign({}, state), { date: currentDate.format(format) })));
|
|
248
249
|
}
|
|
249
250
|
catch (error) {
|
|
250
251
|
handleError(error, {
|
|
@@ -381,11 +382,7 @@ export const AdvancedPicker = props => {
|
|
|
381
382
|
!!label && typeof label === 'string' ? (React.createElement(Text, { style: { color: '#666666' } }, label)) : (label),
|
|
382
383
|
option.dateType.value === 'fixed' &&
|
|
383
384
|
!['WEEK', 'DAY_OF_WEEK', 'MONTH_DAY', 'DAY'].includes(valueType) ? (React.createElement(Tooltip, { title: selectedDateTitle },
|
|
384
|
-
React.createElement(DatePicker
|
|
385
|
-
// ref={ref}
|
|
386
|
-
, {
|
|
387
|
-
// ref={ref}
|
|
388
|
-
disabled: disabled, open: !disabled && isOpen, allowClear: false, inputReadOnly: true, style: Object.assign({ textOverflow: 'ellipsis' }, inputStyle), status: errorMessage ? 'error' : '', inputRender: () => (React.createElement(DatePickerCustomInput, { readOnly: true, placeholder: "Select Date", value: selectedDateTitle, onClick: () => toggleOpenDropdown() })), value: currDate,
|
|
385
|
+
React.createElement(DatePicker, { disabled: disabled, open: !disabled && isOpen, allowClear: false, inputReadOnly: true, style: Object.assign({ textOverflow: 'ellipsis' }, inputStyle), status: errorMessage ? 'error' : '', inputRender: () => (React.createElement(DatePickerCustomInput, { readOnly: true, placeholder: "Select Date", value: selectedDateTitle, onClick: () => toggleOpenDropdown() })), value: currDate,
|
|
389
386
|
// style={{
|
|
390
387
|
// width: 120,
|
|
391
388
|
// }}
|
|
@@ -395,15 +392,22 @@ export const AdvancedPicker = props => {
|
|
|
395
392
|
'only-show-time-picker': ['HOUR', 'MINUTE'].includes(valueType),
|
|
396
393
|
'is-minutes-picker': valueType === 'MINUTE',
|
|
397
394
|
'is-hours-picker': valueType === 'HOUR',
|
|
398
|
-
}), renderExtraFooter: () =>
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
395
|
+
}), renderExtraFooter: () => {
|
|
396
|
+
const timeFormat = getTimePickerRender(valueType);
|
|
397
|
+
return (React.createElement(React.Fragment, null,
|
|
398
|
+
React.createElement(DatePickerHeader, null,
|
|
399
|
+
React.createElement(DropdownLabel, { valueType: valueType, date: date, format: format, type: type, showTime: showTime, operatorKey: operatorKey, formatInputDisplay: formatInputDisplay }),
|
|
400
|
+
renderDateTypeOptions()),
|
|
401
|
+
React.createElement(DatePickerFooter, null,
|
|
402
|
+
React.createElement("div", { style: { padding: '0 10px' } },
|
|
403
|
+
React.createElement(ErrorMessage, { errorMessage: errorMessage })),
|
|
404
|
+
renderDropdownFooter()),
|
|
405
|
+
React.createElement(Divider, null),
|
|
406
|
+
timeFormat && valueType !== 'HOUR' && valueType !== 'MINUTE' ? (React.createElement(TimeLabel, { "$width": timeFormat.length * 30 },
|
|
407
|
+
['HH', 'HHmm', 'HHmmss'].includes(timeFormat) ? React.createElement("span", null, "Hours") : null,
|
|
408
|
+
['HHmm', 'HHmmss', 'mm'].includes(timeFormat) ? React.createElement("span", null, "Minutes") : null,
|
|
409
|
+
timeFormat === 'HHmmss' ? React.createElement("span", null, "Seconds") : null)) : null));
|
|
410
|
+
}, picker: getPickerRender(valueType), showTime: getTimePickerRender(valueType)
|
|
407
411
|
? {
|
|
408
412
|
format: getTimePickerRender(valueType),
|
|
409
413
|
}
|
|
@@ -7,3 +7,6 @@ export declare const DatePickerCustomInput: import("styled-components").StyledCo
|
|
|
7
7
|
export declare const InputStyled: import("styled-components").StyledComponent<import("react").ComponentType<any> | keyof import("react").JSX.IntrinsicElements, any, import("../../../../atoms/Input").InputProps, any>;
|
|
8
8
|
export declare const DatePickerFooter: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
9
|
export declare const CalendarIconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
export declare const TimeLabel: import("styled-components").StyledComponent<"div", any, {
|
|
11
|
+
$width: number;
|
|
12
|
+
}, never>;
|
|
@@ -98,3 +98,26 @@ export const CalendarIconWrapper = styled.div `
|
|
|
98
98
|
cursor: pointer;
|
|
99
99
|
pointer-events: all;
|
|
100
100
|
`;
|
|
101
|
+
export const TimeLabel = styled.div `
|
|
102
|
+
position: absolute;
|
|
103
|
+
right: 0;
|
|
104
|
+
top: 120px;
|
|
105
|
+
height: 39.1px;
|
|
106
|
+
width: ${props => `${props.$width}px`};
|
|
107
|
+
/* width: 180px; */
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: stretch;
|
|
110
|
+
justify-content: space-around;
|
|
111
|
+
|
|
112
|
+
span {
|
|
113
|
+
width: 60px;
|
|
114
|
+
display: block;
|
|
115
|
+
text-align: center;
|
|
116
|
+
font-weight: bold;
|
|
117
|
+
border-left: 1px solid rgba(5, 5, 5, 0.06);
|
|
118
|
+
|
|
119
|
+
&:first-child {
|
|
120
|
+
border-left-color: transparent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
@@ -30,7 +30,7 @@ export declare const getCellRender: (current: number | Dayjs, valueType: ValueTy
|
|
|
30
30
|
* @returns {'date' | 'week' | 'month' | 'quarter' | 'year'} picker ant-design props to render type of calendar
|
|
31
31
|
*/
|
|
32
32
|
export declare const getPickerRender: (valueType: ValueTypes) => 'date' | 'week' | 'month' | 'quarter' | 'year';
|
|
33
|
-
export declare const getTimePickerRender: (valueType: ValueTypes) =>
|
|
33
|
+
export declare const getTimePickerRender: (valueType: ValueTypes) => 'HH' | 'HHmm' | 'HHmmss' | 'mm' | undefined;
|
|
34
34
|
export declare function getLabelQuarterRange(day: string, format: string, locale: string, showYear?: boolean): string;
|
|
35
35
|
export declare function getLabelQuarterRange(quarter: number, year?: number): string;
|
|
36
36
|
export declare const getFormatDisplay: (operatorKey?: TOperatorKey, type?: TAdvancedType, valueType?: ValueTypes, formatInputDisplay?: string) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const THUMBNAIL_CARD_DEFAULT_WIDTH =
|
|
2
|
-
export declare const THUMBNAIL_CARD_DEFAULT_HEIGHT =
|
|
1
|
+
export declare const THUMBNAIL_CARD_DEFAULT_WIDTH = 330;
|
|
2
|
+
export declare const THUMBNAIL_CARD_DEFAULT_HEIGHT = 230;
|
|
3
3
|
export declare const THUMBNAIL_URL = "https://st-media-template.antsomi.com/base64-img/37563.png";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const THUMBNAIL_CARD_DEFAULT_WIDTH =
|
|
2
|
-
export const THUMBNAIL_CARD_DEFAULT_HEIGHT =
|
|
1
|
+
export const THUMBNAIL_CARD_DEFAULT_WIDTH = 330;
|
|
2
|
+
export const THUMBNAIL_CARD_DEFAULT_HEIGHT = 230;
|
|
3
3
|
export const THUMBNAIL_URL = 'https://st-media-template.antsomi.com/base64-img/37563.png';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
|
+
import { isString } from 'lodash';
|
|
3
4
|
// Styled
|
|
4
5
|
import { BannerWrapper } from './styled';
|
|
5
6
|
export const Banner = memo(props => {
|
|
6
|
-
const { deviceType, image } = props;
|
|
7
|
-
return (React.createElement(BannerWrapper, { deviceType: deviceType },
|
|
7
|
+
const { deviceType, image, showBackgroundSkeleton = false } = props;
|
|
8
|
+
return (React.createElement(BannerWrapper, { deviceType: deviceType, showBackgroundSkeleton: showBackgroundSkeleton },
|
|
8
9
|
React.createElement("div", { className: "device-type" },
|
|
9
10
|
React.createElement("div", { className: "device-type__wrapper" },
|
|
10
|
-
React.createElement("div", { className: "image-wrapper" }, image && React.createElement("img", { src: image, alt: "" })),
|
|
11
|
+
React.createElement("div", { className: "image-wrapper" }, image && (isString(image) ? React.createElement("img", { src: image, alt: "" }) : image)),
|
|
11
12
|
React.createElement("div", { className: "backdrop" })))));
|
|
12
13
|
});
|
|
@@ -9,13 +9,23 @@ const { MOBILE } = DEVICE_TYPE;
|
|
|
9
9
|
export const BannerWrapper = styled.div `
|
|
10
10
|
width: 100%;
|
|
11
11
|
height: 762px;
|
|
12
|
+
max-height: 762px;
|
|
13
|
+
overflow-y: auto;
|
|
12
14
|
display: flex;
|
|
13
15
|
justify-content: center;
|
|
14
16
|
align-items: center;
|
|
17
|
+
background-color: #0000001a;
|
|
15
18
|
|
|
16
19
|
.device-type {
|
|
17
20
|
position: relative;
|
|
21
|
+
height: 750px;
|
|
18
22
|
border-radius: ${THUMBNAIL_CARD_RADIUS}px;
|
|
23
|
+
width: 100%;
|
|
24
|
+
|
|
25
|
+
.device-type__wrapper {
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
}
|
|
19
29
|
|
|
20
30
|
${p => {
|
|
21
31
|
switch (p.deviceType) {
|
|
@@ -48,27 +58,24 @@ export const BannerWrapper = styled.div `
|
|
|
48
58
|
}
|
|
49
59
|
`;
|
|
50
60
|
default:
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
left: 0;
|
|
70
|
-
}
|
|
71
|
-
`;
|
|
61
|
+
return p.showBackgroundSkeleton
|
|
62
|
+
? `
|
|
63
|
+
.device-type__wrapper {
|
|
64
|
+
background: center / cover no-repeat url(${skeletonBackground});
|
|
65
|
+
.backdrop {
|
|
66
|
+
border-radius: ${THUMBNAIL_CARD_RADIUS}px;
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
background-color: black;
|
|
71
|
+
opacity: 0.5;
|
|
72
|
+
z-index: 10;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`
|
|
78
|
+
: '';
|
|
72
79
|
}
|
|
73
80
|
}}
|
|
74
81
|
|
|
@@ -8,22 +8,22 @@ import { Button, Radio, Typography, Flex } from '../../../../atoms';
|
|
|
8
8
|
// Constants
|
|
9
9
|
import { DEVICE_TYPE } from '../../constants';
|
|
10
10
|
export const Information = memo(props => {
|
|
11
|
-
const { deviceType, itemName = 'Template name', buttonText = 'Use template', description = 'Description show here', categoryListing, showDeviceRadios = true,
|
|
11
|
+
const { deviceType, itemName = 'Template name', buttonText = 'Use template', description = 'Description show here', categoryListing, showDeviceRadios = true, onButtonClick, onDeviceTypeChange, } = props;
|
|
12
12
|
return (React.createElement(InformationWrapper, { gap: 20, vertical: true },
|
|
13
|
-
React.createElement("div",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
React.createElement("div", { style: { flexShrink: 0 }, className: "title" }, itemName),
|
|
14
|
+
React.createElement(Flex, { gap: 20, vertical: true, className: "content-information" },
|
|
15
|
+
React.createElement("div", null, description), categoryListing === null || categoryListing === void 0 ? void 0 :
|
|
16
|
+
categoryListing.map(({ key, label, children }) => (React.createElement("div", { key: key },
|
|
17
|
+
React.createElement("div", null,
|
|
18
|
+
label,
|
|
19
|
+
":"),
|
|
20
|
+
React.createElement("div", { style: { fontWeight: 'bold' } }, children === null || children === void 0 ? void 0 : children.map(({ label }) => label).join(', ')))))),
|
|
21
21
|
showDeviceRadios && (React.createElement(Radio.Group, { options: Object.values(DEVICE_TYPE).map(({ value, label, icon }) => ({
|
|
22
|
-
label: (React.createElement(Flex, { gap: 5 },
|
|
23
|
-
React.createElement(Icon, { type: icon
|
|
22
|
+
label: (React.createElement(Flex, { gap: 5, align: "center" },
|
|
23
|
+
React.createElement(Icon, { type: icon }),
|
|
24
24
|
label)),
|
|
25
25
|
value,
|
|
26
|
-
})), onChange: e => onDeviceTypeChange(e.target.value), value: deviceType, optionType: "button" })),
|
|
27
|
-
React.createElement(Button, { type: "primary", style: { width: '100%' }, onClick:
|
|
26
|
+
})), onChange: e => onDeviceTypeChange(e.target.value), value: deviceType, optionType: "button", style: { flexShrink: 0 } })),
|
|
27
|
+
React.createElement(Button, { type: "primary", style: { width: '100%', flexShrink: 0 }, onClick: onButtonClick },
|
|
28
28
|
React.createElement(Typography.Text, { ellipsis: { tooltip: buttonText }, style: { maxWidth: '100%', color: 'inherit' } }, buttonText))));
|
|
29
29
|
});
|
|
@@ -6,6 +6,7 @@ export const InformationWrapper = styled(Flex) `
|
|
|
6
6
|
width: 350px;
|
|
7
7
|
flex-shrink: 0;
|
|
8
8
|
font-size: 12px;
|
|
9
|
+
max-height: 762px;
|
|
9
10
|
|
|
10
11
|
.title {
|
|
11
12
|
font-size: 16px;
|
|
@@ -25,6 +26,16 @@ export const InformationWrapper = styled(Flex) `
|
|
|
25
26
|
justify-content: center;
|
|
26
27
|
align-items: center;
|
|
27
28
|
height: 30px;
|
|
29
|
+
|
|
30
|
+
i {
|
|
31
|
+
height: fit-content;
|
|
32
|
+
font-size: 24px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.content-information {
|
|
37
|
+
flex: 1 1 0%;
|
|
38
|
+
overflow-y: auto;
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
`;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
// Libraries
|
|
2
13
|
import React, { memo } from 'react';
|
|
3
14
|
// Components
|
|
4
15
|
import { ThumbnailCard } from '../../../../molecules';
|
|
5
16
|
// Styled
|
|
6
17
|
import { CardListWrapper, SimilarTemplateWrapper } from './styled';
|
|
18
|
+
// Constants
|
|
19
|
+
import { SIMILAR_CARD_HEIGHT_DEFAULT, SIMILAR_CARD_WIDTH_DEFAULT } from '../../constants';
|
|
7
20
|
const MAX_QUANTITY_TEMPLATES = 4;
|
|
8
21
|
export const SimilarTemplate = memo(props => {
|
|
9
22
|
var _a;
|
|
10
23
|
const { show = true, similarTemplates, similarCardProps } = props;
|
|
24
|
+
const _b = similarCardProps || {}, { width = SIMILAR_CARD_WIDTH_DEFAULT, height = SIMILAR_CARD_HEIGHT_DEFAULT } = _b, restOfSimilarCardProps = __rest(_b, ["width", "height"]);
|
|
11
25
|
return show ? (React.createElement(SimilarTemplateWrapper, { gap: 15, vertical: true },
|
|
12
26
|
React.createElement("div", { className: "title" }, "Similar templates"),
|
|
13
|
-
React.createElement(CardListWrapper, { gap: 30 }, (_a = similarTemplates === null || similarTemplates === void 0 ? void 0 : similarTemplates.slice(0, MAX_QUANTITY_TEMPLATES)) === null || _a === void 0 ? void 0 : _a.map(({ id, name, thumbnail }) => (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id, name: name, thumbnail: thumbnail, actionAvailable: false },
|
|
27
|
+
React.createElement(CardListWrapper, { gap: 30 }, (_a = similarTemplates === null || similarTemplates === void 0 ? void 0 : similarTemplates.slice(0, MAX_QUANTITY_TEMPLATES)) === null || _a === void 0 ? void 0 : _a.map(({ id, name, thumbnail }) => (React.createElement(ThumbnailCard, Object.assign({ key: id, id: id, name: name, width: width, height: height, thumbnail: thumbnail, actionAvailable: false }, restOfSimilarCardProps))))))) : null;
|
|
14
28
|
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { SimilarTemplateProps, ThumbnailProps } from '../types';
|
|
1
2
|
export declare const THUMBNAIL_WIDTH_DEFAULT = 180;
|
|
2
3
|
export declare const THUMBNAIL_HEIGHT_DEFAULT = 180;
|
|
4
|
+
export declare const SIMILAR_CARD_WIDTH_DEFAULT = 330;
|
|
5
|
+
export declare const SIMILAR_CARD_HEIGHT_DEFAULT = 230;
|
|
3
6
|
export declare const THUMBNAIL_URL = "https://st-media-template.antsomi.com/base64-img/37563.png";
|
|
7
|
+
export declare const SIMILAR_TEMPLATE_DEFAULT: SimilarTemplateProps;
|
|
8
|
+
export declare const THUMBNAIL_DEFAULT: ThumbnailProps;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export const THUMBNAIL_WIDTH_DEFAULT = 180;
|
|
2
2
|
export const THUMBNAIL_HEIGHT_DEFAULT = 180;
|
|
3
|
+
export const SIMILAR_CARD_WIDTH_DEFAULT = 330;
|
|
4
|
+
export const SIMILAR_CARD_HEIGHT_DEFAULT = 230;
|
|
3
5
|
export const THUMBNAIL_URL = 'https://st-media-template.antsomi.com/base64-img/37563.png';
|
|
6
|
+
export const SIMILAR_TEMPLATE_DEFAULT = {
|
|
7
|
+
show: false,
|
|
8
|
+
};
|
|
9
|
+
export const THUMBNAIL_DEFAULT = {
|
|
10
|
+
thumbnails: [],
|
|
11
|
+
};
|
|
@@ -12,22 +12,23 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
// Libraries
|
|
13
13
|
import React, { memo, useState } from 'react';
|
|
14
14
|
// Components
|
|
15
|
-
import { Flex } from '../../atoms';
|
|
15
|
+
import { Flex, Spin } from '../../atoms';
|
|
16
16
|
import { Banner, Information, SimilarTemplate, ThumbnailSlider } from './components';
|
|
17
17
|
// Styled
|
|
18
18
|
import { ModalContainer, ModalWrapper } from './styled';
|
|
19
19
|
// Constants
|
|
20
|
-
import { DEVICE_TYPE } from './constants';
|
|
20
|
+
import { DEVICE_TYPE, SIMILAR_TEMPLATE_DEFAULT, THUMBNAIL_DEFAULT } from './constants';
|
|
21
21
|
export const PreviewTemplateModal = memo(props => {
|
|
22
|
-
const {
|
|
22
|
+
const { bannerProps, thumbnailProps = THUMBNAIL_DEFAULT, similarTemplateProps = SIMILAR_TEMPLATE_DEFAULT, informationProps, loading = false } = props, restOfProps = __rest(props, ["bannerProps", "thumbnailProps", "similarTemplateProps", "informationProps", "loading"]);
|
|
23
23
|
// States
|
|
24
24
|
const [deviceType, setDeviceType] = useState(DEVICE_TYPE.DESKTOP.value);
|
|
25
25
|
return (React.createElement(ModalContainer, Object.assign({ footer: null, centered: true, modalRender: node => React.createElement(ModalWrapper, null, node) }, restOfProps),
|
|
26
|
-
React.createElement(
|
|
27
|
-
React.createElement(
|
|
28
|
-
React.createElement(
|
|
29
|
-
React.createElement(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
React.createElement(Spin, { spinning: loading },
|
|
27
|
+
React.createElement(Flex, { gap: 20 },
|
|
28
|
+
React.createElement("div", { className: "overview" },
|
|
29
|
+
React.createElement(Flex, { gap: 20, vertical: true },
|
|
30
|
+
React.createElement(Banner, Object.assign({ deviceType: deviceType }, bannerProps)),
|
|
31
|
+
React.createElement(ThumbnailSlider, Object.assign({}, thumbnailProps)))),
|
|
32
|
+
React.createElement(Information, Object.assign({ deviceType: deviceType, onDeviceTypeChange: value => setDeviceType(value) }, informationProps))),
|
|
33
|
+
React.createElement(SimilarTemplate, Object.assign({}, similarTemplateProps)))));
|
|
33
34
|
});
|
|
@@ -2,7 +2,7 @@ import styled from 'styled-components';
|
|
|
2
2
|
import { Modal } from '../../molecules';
|
|
3
3
|
export const ModalContainer = styled(Modal) `
|
|
4
4
|
&.antsomi-modal {
|
|
5
|
-
width:
|
|
5
|
+
width: fit-content !important;
|
|
6
6
|
|
|
7
7
|
.antsomi-modal-content {
|
|
8
8
|
width: 1440px;
|
|
@@ -20,6 +20,6 @@ export const ModalContainer = styled(Modal) `
|
|
|
20
20
|
`;
|
|
21
21
|
export const ModalWrapper = styled.div `
|
|
22
22
|
padding: 20px;
|
|
23
|
-
width:
|
|
23
|
+
width: fit-content;
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
`;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { ThumbnailCardProps } from '../../molecules';
|
|
3
3
|
import { ModalProps } from '../../molecules/Modal';
|
|
4
4
|
import { TTemplateItem, TCategoryItem } from '../../template';
|
|
@@ -7,11 +7,16 @@ export type TThumbnail = {
|
|
|
7
7
|
url: string;
|
|
8
8
|
};
|
|
9
9
|
export interface PreviewTemplateModalProps extends ModalProps {
|
|
10
|
-
|
|
10
|
+
bannerProps?: Omit<BannerProps, 'deviceType'>;
|
|
11
11
|
thumbnailProps?: ThumbnailProps;
|
|
12
12
|
similarTemplateProps?: SimilarTemplateProps;
|
|
13
13
|
informationProps?: Omit<InformationProps, 'deviceType' | 'onDeviceTypeChange'>;
|
|
14
14
|
}
|
|
15
|
+
export interface BannerProps {
|
|
16
|
+
image?: ReactNode | string;
|
|
17
|
+
deviceType: InformationProps['deviceType'];
|
|
18
|
+
showBackgroundSkeleton?: boolean;
|
|
19
|
+
}
|
|
15
20
|
export type ThumbnailProps = Omit<ThumbnailCardProps, keyof TTemplateItem | 'onClickWrapper'> & {
|
|
16
21
|
thumbnails?: TThumbnail[];
|
|
17
22
|
onClickThumbnail?: (value: TThumbnail) => void;
|
|
@@ -28,6 +33,7 @@ export interface InformationProps {
|
|
|
28
33
|
buttonText?: string;
|
|
29
34
|
description?: string;
|
|
30
35
|
showDeviceRadios?: boolean;
|
|
36
|
+
loading?: boolean;
|
|
31
37
|
onDeviceTypeChange: (value: string) => void;
|
|
32
|
-
|
|
38
|
+
onButtonClick?: React.MouseEventHandler<HTMLElement>;
|
|
33
39
|
}
|