@antscorp/antsomi-ui 1.3.5-beta.255 → 1.3.5-beta.256
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.
|
@@ -10,7 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
|
-
import React, { memo, useState } from 'react';
|
|
13
|
+
import React, { memo, useEffect, useState } from 'react';
|
|
14
|
+
import { isNil } from 'lodash';
|
|
14
15
|
// Components
|
|
15
16
|
import { Flex, Spin } from '../../atoms';
|
|
16
17
|
import { Banner, Information, SimilarTemplate, ThumbnailSlider } from './components';
|
|
@@ -22,6 +23,11 @@ export const PreviewTemplateModal = memo(props => {
|
|
|
22
23
|
const { bannerProps, thumbnailProps = THUMBNAIL_DEFAULT, similarTemplateProps = SIMILAR_TEMPLATE_DEFAULT, informationProps, loading = false } = props, restOfProps = __rest(props, ["bannerProps", "thumbnailProps", "similarTemplateProps", "informationProps", "loading"]);
|
|
23
24
|
// States
|
|
24
25
|
const [deviceType, setDeviceType] = useState(DEVICE_TYPE.DESKTOP.value);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!isNil(bannerProps === null || bannerProps === void 0 ? void 0 : bannerProps.deviceType)) {
|
|
28
|
+
setDeviceType(bannerProps.deviceType);
|
|
29
|
+
}
|
|
30
|
+
}, [bannerProps === null || bannerProps === void 0 ? void 0 : bannerProps.deviceType]);
|
|
25
31
|
return (React.createElement(ModalContainer, Object.assign({ footer: null, centered: true, modalRender: node => React.createElement(ModalWrapper, null, node) }, restOfProps),
|
|
26
32
|
React.createElement(Spin, { spinning: loading },
|
|
27
33
|
React.createElement(Flex, { gap: 20 },
|
|
@@ -7,13 +7,13 @@ export type TThumbnail = {
|
|
|
7
7
|
url: string;
|
|
8
8
|
};
|
|
9
9
|
export interface PreviewTemplateModalProps extends ModalProps {
|
|
10
|
-
bannerProps?:
|
|
10
|
+
bannerProps?: BannerProps;
|
|
11
11
|
thumbnailProps?: ThumbnailProps;
|
|
12
12
|
similarTemplateProps?: SimilarTemplateProps;
|
|
13
13
|
informationProps?: Omit<InformationProps, 'deviceType' | 'onDeviceTypeChange'>;
|
|
14
14
|
}
|
|
15
15
|
export interface BannerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
-
deviceType
|
|
16
|
+
deviceType?: InformationProps['deviceType'];
|
|
17
17
|
showSkeleton?: boolean;
|
|
18
18
|
height?: number;
|
|
19
19
|
children?: React.ReactNode;
|