@arcblock/ux 2.10.67 → 2.10.68
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/Address/did-address.d.ts +6 -5
- package/lib/Address/index.d.ts +1 -1
- package/lib/Avatar/index.d.ts +10 -8
- package/lib/Avatar/index.js +6 -4
- package/lib/Blocklet/blocklet.d.ts +4 -4
- package/lib/Blocklet/blocklet.js +2 -2
- package/lib/BlockletContext/index.d.ts +3 -3
- package/lib/BlockletNFT/index.d.ts +6 -6
- package/lib/BlockletNFT/index.js +3 -3
- package/lib/BlockletV2/blocklet.d.ts +2 -2
- package/lib/Button/wrap.d.ts +4 -4
- package/lib/Button/wrap.js +2 -2
- package/lib/CardSelector/index.js +0 -1
- package/lib/Center/index.d.ts +1 -1
- package/lib/ClickToCopy/copy-button.d.ts +5 -4
- package/lib/ClickToCopy/copy-button.js +0 -1
- package/lib/ClickToCopy/hook.d.ts +3 -8
- package/lib/ClickToCopy/index.d.ts +6 -4
- package/lib/CodeBlock/index.d.ts +3 -1
- package/lib/CookieConsent/index.d.ts +8 -29
- package/lib/CookieConsent/index.js +3 -17
- package/lib/CountDown/index.d.ts +21 -25
- package/lib/CountDown/index.js +12 -11
- package/lib/DID/index.d.ts +9 -8
- package/lib/Datatable/index.d.ts +5 -5
- package/lib/Datatable/index.js +5 -5
- package/lib/Dialog/confirm.d.ts +6 -6
- package/lib/Dialog/confirm.js +3 -3
- package/lib/Dialog/types.d.ts +1 -1
- package/lib/DidLogo/index.d.ts +5 -25
- package/lib/DidLogo/index.js +4 -15
- package/lib/DriftBot/index.d.ts +13 -19
- package/lib/DriftBot/index.js +5 -6
- package/lib/Earth/index.d.ts +28 -10
- package/lib/Earth/index.js +12 -52
- package/lib/Earth/util.d.ts +10 -5
- package/lib/Earth/util.js +1 -0
- package/lib/ErrorBoundary/fallback.d.ts +12 -19
- package/lib/ErrorBoundary/fallback.js +2 -19
- package/lib/ErrorBoundary/index.d.ts +1 -1
- package/lib/Footer/index.d.ts +17 -24
- package/lib/Footer/index.js +2 -11
- package/lib/Header/header.d.ts +2 -2
- package/lib/Icon/image.d.ts +3 -2
- package/lib/Icon/index.d.ts +6 -4
- package/lib/Img/index.d.ts +1 -1
- package/lib/Img/index.js +1 -1
- package/lib/InfoRow/index.d.ts +9 -32
- package/lib/InfoRow/index.js +10 -23
- package/lib/Layout/dashboard/external-link.d.ts +13 -14
- package/lib/Layout/dashboard/external-link.js +5 -22
- package/lib/Layout/dashboard/full-page.d.ts +19 -11
- package/lib/Layout/dashboard/full-page.js +2 -6
- package/lib/Layout/dashboard/index.d.ts +20 -39
- package/lib/Layout/dashboard/index.js +10 -38
- package/lib/Layout/dashboard/sidebar.d.ts +17 -20
- package/lib/Layout/dashboard/sidebar.js +3 -16
- package/lib/Layout/dashboard-legacy/header.d.ts +10 -36
- package/lib/Layout/dashboard-legacy/header.js +5 -24
- package/lib/Layout/dashboard-legacy/index.d.ts +17 -56
- package/lib/Layout/dashboard-legacy/index.js +12 -41
- package/lib/Layout/dashboard-legacy/sidebar.d.ts +15 -26
- package/lib/Layout/dashboard-legacy/sidebar.js +5 -15
- package/lib/Layout/index.d.ts +17 -56
- package/lib/Layout/index.js +24 -50
- package/lib/LoadingMask/index.d.ts +8 -31
- package/lib/LoadingMask/index.js +2 -18
- package/lib/Locale/browser-lang.d.ts +4 -1
- package/lib/Locale/browser-lang.js +8 -3
- package/lib/Locale/context.d.ts +18 -8
- package/lib/Locale/context.js +1 -1
- package/lib/Locale/languages.d.ts +9 -55
- package/lib/Locale/selector.d.ts +10 -26
- package/lib/Locale/selector.js +8 -25
- package/lib/Locale/util.d.ts +4 -3
- package/lib/Locale/util.js +0 -1
- package/lib/Logo/index.d.ts +9 -40
- package/lib/Logo/index.js +88 -46
- package/lib/Metric/index.d.ts +9 -31
- package/lib/Metric/index.js +5 -20
- package/lib/NFTDisplay/aspect-ratio-container.d.ts +5 -12
- package/lib/NFTDisplay/aspect-ratio-container.js +0 -5
- package/lib/NFTDisplay/broken.d.ts +3 -13
- package/lib/NFTDisplay/broken.js +80 -10
- package/lib/NFTDisplay/displayApi.d.ts +1 -1
- package/lib/NFTDisplay/index.d.ts +28 -6
- package/lib/NFTDisplay/index.js +17 -51
- package/lib/NFTDisplay/svg-embedder/img.d.ts +8 -23
- package/lib/NFTDisplay/svg-embedder/img.js +3 -17
- package/lib/NFTDisplay/svg-embedder/inline-svg.d.ts +7 -13
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +1 -8
- package/lib/NavMenu/nav-menu.d.ts +2 -0
- package/lib/NavMenu/nav-menu.js +0 -1
- package/lib/PageScroller/index.d.ts +14 -13
- package/lib/PageScroller/index.js +12 -37
- package/lib/PageScroller/usePrevValue.d.ts +1 -1
- package/lib/PageScroller/usePrevValue.js +1 -2
- package/lib/Passport/index.d.ts +1 -1
- package/lib/Passport/passport.d.ts +10 -30
- package/lib/Passport/passport.js +5 -19
- package/lib/PoweredByArcBlock/index.d.ts +4 -14
- package/lib/PoweredByArcBlock/index.js +1 -8
- package/lib/PricingTable/PricingPlan.d.ts +11 -9
- package/lib/PricingTable/PricingPlan.js +0 -4
- package/lib/PricingTable/index.d.ts +5 -3
- package/lib/PricingTable/index.js +1 -5
- package/lib/QRCode/index.d.ts +11 -22
- package/lib/QRCode/index.js +1 -15
- package/lib/RelativeTime/index.d.ts +12 -40
- package/lib/RelativeTime/index.js +7 -27
- package/lib/Result/common.d.ts +26 -45
- package/lib/Result/common.js +2 -4
- package/lib/Result/index.d.ts +5 -18
- package/lib/Result/index.js +1 -9
- package/lib/Result/result.d.ts +7 -29
- package/lib/Result/result.js +2 -17
- package/lib/Result/translations.d.ts +2 -54
- package/lib/Screenshot/BaseScreenshot/index.d.ts +7 -24
- package/lib/Screenshot/BaseScreenshot/index.js +2 -15
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.d.ts +25 -19
- package/lib/Screenshot/BaseScreenshot/shells/Phone.d.ts +25 -19
- package/lib/Screenshot/index.d.ts +84 -28
- package/lib/Screenshot/index.js +14 -43
- package/lib/SessionBlocklet/index.d.ts +6 -19
- package/lib/SessionBlocklet/index.js +3 -14
- package/lib/SessionManager/index.d.ts +1 -1
- package/lib/SessionPermission/index.d.ts +9 -17
- package/lib/SessionPermission/index.js +3 -11
- package/lib/SessionUser/components/logged-in.d.ts +9 -31
- package/lib/SessionUser/components/logged-in.js +13 -29
- package/lib/SessionUser/components/session-user-item.d.ts +8 -1
- package/lib/SessionUser/components/session-user-item.js +2 -12
- package/lib/SessionUser/components/session-user-switch.d.ts +9 -21
- package/lib/SessionUser/components/session-user-switch.js +3 -15
- package/lib/SessionUser/components/un-login.d.ts +7 -23
- package/lib/SessionUser/components/un-login.js +4 -16
- package/lib/SessionUser/components/user-info.d.ts +12 -29
- package/lib/SessionUser/components/user-info.js +4 -19
- package/lib/SessionUser/index.d.ts +7 -30
- package/lib/SessionUser/index.js +5 -26
- package/lib/SessionUser/libs/translation.d.ts +2 -31
- package/lib/SessionUser/libs/translation.js +1 -0
- package/lib/SessionUser/libs/utils.d.ts +10 -9
- package/lib/Sparkline/index.d.ts +22 -1
- package/lib/Sparkline/index.js +25 -17
- package/lib/Spinner/index.d.ts +6 -1
- package/lib/Spinner/index.js +4 -11
- package/lib/Success/index.d.ts +5 -21
- package/lib/Success/index.js +4 -16
- package/lib/Tabs/index.d.ts +12 -26
- package/lib/Tabs/index.js +7 -37
- package/lib/TextCollapse/index.d.ts +10 -10
- package/lib/TextCollapse/index.js +4 -21
- package/lib/Theme/index.js +0 -2
- package/lib/Theme/theme-provider.d.ts +1 -1
- package/lib/Theme/theme.d.ts +4 -1
- package/lib/Theme/theme.js +1 -2
- package/lib/Typography/index.d.ts +5 -24
- package/lib/Typography/index.js +5 -17
- package/lib/Util/index.d.ts +11 -6
- package/lib/Util/index.js +6 -0
- package/lib/Video/index.d.ts +12 -16
- package/lib/Video/index.js +0 -14
- package/lib/Wallet/Action.d.ts +13 -18
- package/lib/Wallet/Action.js +0 -7
- package/lib/Wallet/Download.d.ts +24 -30
- package/lib/Wallet/Download.js +201 -18
- package/lib/Wallet/Open.d.ts +5 -15
- package/lib/Wallet/Open.js +5 -11
- package/lib/WalletOSIcon/index.d.ts +6 -25
- package/lib/WalletOSIcon/index.js +3 -16
- package/lib/WebWalletSWKeeper/index.d.ts +8 -20
- package/lib/WebWalletSWKeeper/index.js +14 -19
- package/lib/WechatPrompt/index.js +2 -0
- package/lib/global.d.ts +15 -0
- package/lib/type.d.ts +12 -3
- package/lib/withTheme/index.d.ts +8 -6
- package/lib/withTracker/index.d.ts +1 -1
- package/lib/withTracker/index.js +3 -0
- package/package.json +9 -5
- package/src/Address/did-address.tsx +7 -6
- package/src/Address/index.tsx +1 -1
- package/src/Avatar/index.jsx +6 -4
- package/src/Blocklet/blocklet.jsx +2 -2
- package/src/BlockletContext/index.tsx +3 -3
- package/src/BlockletNFT/index.jsx +3 -3
- package/src/BlockletV2/blocklet.tsx +2 -2
- package/src/Button/wrap.jsx +2 -2
- package/src/CardSelector/index.tsx +0 -1
- package/src/Center/index.tsx +1 -1
- package/src/ClickToCopy/copy-button.tsx +4 -4
- package/src/ClickToCopy/hook.ts +3 -2
- package/src/ClickToCopy/index.tsx +6 -5
- package/src/CodeBlock/index.tsx +3 -1
- package/src/CookieConsent/{index.jsx → index.tsx} +16 -19
- package/src/CountDown/{index.jsx → index.tsx} +30 -16
- package/src/DID/index.tsx +9 -8
- package/src/Datatable/index.jsx +5 -5
- package/src/Dialog/confirm.jsx +3 -3
- package/src/Dialog/types.d.ts +1 -1
- package/src/DidLogo/{index.jsx → index.tsx} +7 -14
- package/src/DriftBot/{index.jsx → index.tsx} +13 -11
- package/src/Earth/{index.jsx → index.tsx} +94 -66
- package/src/Earth/{util.js → util.ts} +20 -17
- package/src/ErrorBoundary/{fallback.jsx → fallback.tsx} +20 -21
- package/src/Footer/{index.jsx → index.tsx} +17 -14
- package/src/Header/header.tsx +2 -3
- package/src/Header/responsive-header.tsx +0 -1
- package/src/Icon/image.tsx +3 -3
- package/src/Icon/index.tsx +7 -4
- package/src/Img/index.jsx +1 -1
- package/src/InfoRow/{index.jsx → index.tsx} +32 -25
- package/src/Layout/dashboard/external-link.tsx +46 -0
- package/src/Layout/dashboard/{full-page.jsx → full-page.tsx} +20 -9
- package/src/Layout/dashboard/{index.jsx → index.tsx} +42 -44
- package/src/Layout/dashboard/{sidebar.jsx → sidebar.tsx} +23 -20
- package/src/Layout/dashboard-legacy/{header.jsx → header.tsx} +16 -26
- package/src/Layout/dashboard-legacy/{index.jsx → index.tsx} +32 -46
- package/src/Layout/dashboard-legacy/{sidebar.jsx → sidebar.tsx} +27 -19
- package/src/Layout/{index.jsx → index.tsx} +41 -47
- package/src/LoadingMask/{index.jsx → index.tsx} +17 -19
- package/src/Locale/{browser-lang.js → browser-lang.ts} +9 -7
- package/src/Locale/context.tsx +18 -11
- package/src/Locale/{languages.js → languages.ts} +1 -1
- package/src/Locale/{selector.jsx → selector.tsx} +32 -29
- package/src/Locale/{util.js → util.ts} +9 -2
- package/src/Logo/index.tsx +58 -0
- package/src/Metric/{index.jsx → index.tsx} +23 -18
- package/src/NFTDisplay/{aspect-ratio-container.jsx → aspect-ratio-container.tsx} +9 -7
- package/src/NFTDisplay/{broken.jsx → broken.tsx} +7 -12
- package/src/NFTDisplay/{displayApi.js → displayApi.ts} +4 -4
- package/src/NFTDisplay/{index.jsx → index.tsx} +59 -64
- package/src/NFTDisplay/svg-embedder/{img.jsx → img.tsx} +10 -18
- package/src/NFTDisplay/svg-embedder/{inline-svg.jsx → inline-svg.tsx} +8 -9
- package/src/NavMenu/nav-menu.tsx +2 -3
- package/src/PageScroller/{index.jsx → index.tsx} +40 -53
- package/src/PageScroller/{usePrevValue.js → usePrevValue.ts} +2 -3
- package/src/Passport/{passport.jsx → passport.tsx} +22 -19
- package/src/PoweredByArcBlock/{index.jsx → index.tsx} +6 -11
- package/src/PricingTable/{PricingPlan.jsx → PricingPlan.tsx} +15 -5
- package/src/PricingTable/{index.jsx → index.tsx} +9 -6
- package/src/QRCode/{index.jsx → index.tsx} +13 -17
- package/src/RelativeTime/{index.jsx → index.tsx} +24 -24
- package/src/Result/{common.jsx → common.tsx} +17 -13
- package/src/Result/index.tsx +30 -0
- package/src/Result/{result.jsx → result.tsx} +8 -17
- package/src/Result/{translations.js → translations.ts} +3 -1
- package/src/Screenshot/BaseScreenshot/{index.jsx → index.tsx} +9 -15
- package/src/Screenshot/BaseScreenshot/shells/{Macbook.jsx → Macbook.tsx} +3 -1
- package/src/Screenshot/BaseScreenshot/shells/{Phone.jsx → Phone.tsx} +3 -1
- package/src/Screenshot/{index.jsx → index.tsx} +60 -54
- package/src/SessionBlocklet/{index.jsx → index.tsx} +8 -14
- package/src/SessionPermission/index.tsx +25 -0
- package/src/SessionUser/components/{logged-in.jsx → logged-in.tsx} +49 -31
- package/src/SessionUser/components/session-user-item.tsx +97 -0
- package/src/SessionUser/components/{session-user-switch.jsx → session-user-switch.tsx} +16 -21
- package/src/SessionUser/components/{un-login.jsx → un-login.tsx} +10 -15
- package/src/SessionUser/components/{user-info.jsx → user-info.tsx} +16 -22
- package/src/SessionUser/index.tsx +26 -0
- package/src/SessionUser/libs/{translation.js → translation.ts} +3 -1
- package/src/SessionUser/libs/utils.ts +39 -0
- package/src/Sparkline/{index.jsx → index.tsx} +38 -22
- package/src/Spinner/index.tsx +20 -0
- package/src/Success/{index.jsx → index.tsx} +7 -13
- package/src/Tabs/{index.jsx → index.tsx} +26 -40
- package/src/TextCollapse/{index.jsx → index.tsx} +26 -21
- package/src/Theme/index.ts +0 -1
- package/src/Theme/theme-provider.tsx +1 -1
- package/src/Theme/theme.ts +6 -3
- package/src/Typography/{index.jsx → index.tsx} +19 -22
- package/src/Util/index.ts +14 -8
- package/src/Video/{index.jsx → index.tsx} +7 -10
- package/src/Wallet/{Action.jsx → Action.tsx} +16 -12
- package/src/Wallet/{Download.jsx → Download.tsx} +25 -21
- package/src/Wallet/{Open.jsx → Open.tsx} +8 -11
- package/src/WalletOSIcon/{index.jsx → index.tsx} +8 -16
- package/src/WebWalletSWKeeper/{index.jsx → index.tsx} +21 -24
- package/src/WechatPrompt/{index.jsx → index.tsx} +1 -0
- package/src/global.d.ts +15 -0
- package/src/type.d.ts +12 -3
- package/src/withTheme/{index.jsx → index.tsx} +12 -2
- package/src/withTracker/{index.jsx → index.tsx} +6 -4
- package/src/Layout/dashboard/external-link.jsx +0 -47
- package/src/Logo/index.jsx +0 -66
- package/src/Result/index.jsx +0 -33
- package/src/SessionPermission/index.jsx +0 -28
- package/src/SessionUser/components/session-user-item.jsx +0 -93
- package/src/SessionUser/index.jsx +0 -38
- package/src/SessionUser/libs/utils.js +0 -37
- package/src/Spinner/index.jsx +0 -21
- /package/src/ErrorBoundary/{index.jsx → index.ts} +0 -0
- /package/src/NFTDisplay/{loading.jsx → loading.tsx} +0 -0
- /package/src/Passport/{index.jsx → index.ts} +0 -0
- /package/src/SessionManager/{index.jsx → index.tsx} +0 -0
@@ -1,6 +1,5 @@
|
|
1
1
|
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
|
2
2
|
import { Children, cloneElement, useCallback, useEffect, useRef, useState } from 'react';
|
3
|
-
import PropTypes from 'prop-types';
|
4
3
|
import isEqual from 'lodash/isEqual';
|
5
4
|
import isNil from 'lodash/isNil';
|
6
5
|
import isNull from 'lodash/isNull';
|
@@ -11,7 +10,7 @@ import { withDeprecated } from '../Util/deprecate';
|
|
11
10
|
const Events = {
|
12
11
|
TOUCHMOVE: 'touchmove',
|
13
12
|
KEYDOWN: 'keydown',
|
14
|
-
};
|
13
|
+
} as const;
|
15
14
|
|
16
15
|
const DEFAULT_ANIMATION_TIMER = 500;
|
17
16
|
const DEFAULT_ANIMATION = 'ease-in-out';
|
@@ -25,33 +24,48 @@ const KEY_UP = 38;
|
|
25
24
|
const KEY_DOWN = 40;
|
26
25
|
const DISABLED_CLASS_NAME = 'rps-scroll--disabled';
|
27
26
|
|
28
|
-
let previousTouchMove = null;
|
27
|
+
let previousTouchMove: number | null = null;
|
29
28
|
let isScrolling = false;
|
30
29
|
let isMounted = false;
|
31
30
|
let isBodyScrollEnabled = true;
|
32
31
|
let isTransitionAfterComponentsToRenderChanged = false;
|
33
|
-
const containers = [];
|
32
|
+
const containers: boolean[] = [];
|
33
|
+
|
34
|
+
export interface PageScrollerProps {
|
35
|
+
animationTimer?: number;
|
36
|
+
blockScrollDown?: false | true;
|
37
|
+
blockScrollUp?: false | true;
|
38
|
+
children?: React.ReactElement | React.ReactElement[];
|
39
|
+
height?: number | string;
|
40
|
+
width?: number | string;
|
41
|
+
customPageNumber?: number;
|
42
|
+
onScrollUnavailable?: () => void;
|
43
|
+
onChange?: (index: number) => void;
|
44
|
+
renderAllPagesOnFirstRender?: false | true;
|
45
|
+
transitionTimingFunction?: string;
|
46
|
+
}
|
34
47
|
|
35
48
|
function PageScroller({
|
36
|
-
animationTimer,
|
37
|
-
blockScrollDown,
|
38
|
-
blockScrollUp,
|
39
|
-
children,
|
40
|
-
height,
|
41
|
-
width,
|
49
|
+
animationTimer = DEFAULT_ANIMATION_TIMER,
|
50
|
+
blockScrollDown = false,
|
51
|
+
blockScrollUp = false,
|
52
|
+
children: _children,
|
53
|
+
height = DEFAULT_CONTAINER_HEIGHT,
|
54
|
+
width = DEFAULT_CONTAINER_WIDTH,
|
42
55
|
customPageNumber,
|
43
56
|
onScrollUnavailable,
|
44
57
|
onChange,
|
45
|
-
renderAllPagesOnFirstRender,
|
46
|
-
transitionTimingFunction,
|
47
|
-
}) {
|
58
|
+
renderAllPagesOnFirstRender = false,
|
59
|
+
transitionTimingFunction = DEFAULT_ANIMATION,
|
60
|
+
}: PageScrollerProps) {
|
48
61
|
const [componentIndex, setComponentIndex] = useState(DEFAULT_COMPONENT_INDEX);
|
49
62
|
const [componentsToRenderLength, setComponentsToRenderLength] = useState(DEFAULT_COMPONENTS_TO_RENDER_LENGTH);
|
50
63
|
const prevComponentIndex = usePrevious(componentIndex);
|
51
|
-
const pageContainer = useRef(null);
|
64
|
+
const pageContainer = useRef<HTMLDivElement>(null);
|
65
|
+
const children = Children.toArray(_children) as React.ReactElement[];
|
52
66
|
|
53
67
|
const addNextComponent = useCallback(
|
54
|
-
(componentsToRenderOnMountLength) => {
|
68
|
+
(componentsToRenderOnMountLength?: number) => {
|
55
69
|
let tempComponentsToRenderLength = 0;
|
56
70
|
|
57
71
|
if (!isNil(componentsToRenderOnMountLength)) {
|
@@ -123,7 +137,7 @@ function PageScroller({
|
|
123
137
|
if (!isNil(containers[componentIndex + 1])) {
|
124
138
|
disableScroll();
|
125
139
|
isScrolling = true;
|
126
|
-
pageContainer.current
|
140
|
+
pageContainer.current!.style.transform = `translate3d(0, ${(componentIndex + 1) * -100}%, 0)`; // prettier-ignore
|
127
141
|
|
128
142
|
setTimeout(() => {
|
129
143
|
if (isMounted) {
|
@@ -144,7 +158,7 @@ function PageScroller({
|
|
144
158
|
if (!isNil(containers[componentIndex - 1])) {
|
145
159
|
disableScroll();
|
146
160
|
isScrolling = true;
|
147
|
-
pageContainer.current
|
161
|
+
pageContainer.current!.style.transform = `translate3d(0, ${(componentIndex - 1) * -100}%, 0)`; // prettier-ignore
|
148
162
|
|
149
163
|
setTimeout(() => {
|
150
164
|
if (isMounted) {
|
@@ -161,7 +175,7 @@ function PageScroller({
|
|
161
175
|
}, [animationTimer, blockScrollUp, componentIndex, disableScroll, enableDocumentScroll, onScrollUnavailable]);
|
162
176
|
|
163
177
|
const touchMove = useCallback(
|
164
|
-
(event) => {
|
178
|
+
(event: TouchEvent) => {
|
165
179
|
if (!isNull(previousTouchMove)) {
|
166
180
|
if (event.touches[0].clientY > previousTouchMove) {
|
167
181
|
scrollWindowUp();
|
@@ -176,7 +190,7 @@ function PageScroller({
|
|
176
190
|
);
|
177
191
|
|
178
192
|
const wheelScroll = useCallback(
|
179
|
-
(event) => {
|
193
|
+
(event: React.WheelEvent<HTMLDivElement>) => {
|
180
194
|
if (event.deltaY < 0) {
|
181
195
|
scrollWindowUp();
|
182
196
|
} else {
|
@@ -187,7 +201,7 @@ function PageScroller({
|
|
187
201
|
);
|
188
202
|
|
189
203
|
const keyPress = useCallback(
|
190
|
-
(event) => {
|
204
|
+
(event: KeyboardEvent) => {
|
191
205
|
if (isEqual(event.keyCode, KEY_UP)) {
|
192
206
|
scrollWindowUp();
|
193
207
|
}
|
@@ -199,8 +213,8 @@ function PageScroller({
|
|
199
213
|
);
|
200
214
|
|
201
215
|
useEffect(() => {
|
202
|
-
pageContainer.current
|
203
|
-
pageContainer.current
|
216
|
+
pageContainer.current?.addEventListener(Events.TOUCHMOVE, touchMove);
|
217
|
+
pageContainer.current?.addEventListener(Events.KEYDOWN, keyPress);
|
204
218
|
return () => {
|
205
219
|
if (pageContainer.current?.removeEventListener) {
|
206
220
|
pageContainer.current.removeEventListener(Events.TOUCHMOVE, touchMove);
|
@@ -223,7 +237,7 @@ function PageScroller({
|
|
223
237
|
useEffect(() => {
|
224
238
|
isScrolling = false;
|
225
239
|
previousTouchMove = null;
|
226
|
-
if (componentIndex > prevComponentIndex) {
|
240
|
+
if (prevComponentIndex !== undefined && componentIndex > prevComponentIndex) {
|
227
241
|
addNextComponent();
|
228
242
|
}
|
229
243
|
}, [addNextComponent, componentIndex, prevComponentIndex]);
|
@@ -241,7 +255,7 @@ function PageScroller({
|
|
241
255
|
if (!isEqual(componentIndex, customPageNumber)) {
|
242
256
|
if (!isNil(containers[customPageNumber]) && !isScrolling) {
|
243
257
|
isScrolling = true;
|
244
|
-
pageContainer.current
|
258
|
+
pageContainer.current!.style.transform = `translate3d(0, ${customPageNumber * -100}%, 0)`;
|
245
259
|
|
246
260
|
if (isNil(containers[customPageNumber]) && !isNil(children[customPageNumber])) {
|
247
261
|
newComponentsToRenderLength++;
|
@@ -273,10 +287,10 @@ function PageScroller({
|
|
273
287
|
if (isTransitionAfterComponentsToRenderChanged) {
|
274
288
|
isTransitionAfterComponentsToRenderChanged = false;
|
275
289
|
|
276
|
-
pageContainer.current
|
290
|
+
pageContainer.current!.style.transform = `translate3d(0, ${customPageNumber! * -100}%, 0)`;
|
277
291
|
|
278
292
|
setTimeout(() => {
|
279
|
-
setComponentIndex(customPageNumber);
|
293
|
+
setComponentIndex(customPageNumber!);
|
280
294
|
}, animationTimer + ANIMATION_TIMER_BUFFER);
|
281
295
|
}
|
282
296
|
}, [animationTimer, componentsToRenderLength, customPageNumber]);
|
@@ -299,31 +313,4 @@ function PageScroller({
|
|
299
313
|
);
|
300
314
|
}
|
301
315
|
|
302
|
-
PageScroller.propTypes = {
|
303
|
-
animationTimer: PropTypes.number,
|
304
|
-
blockScrollDown: PropTypes.bool,
|
305
|
-
blockScrollUp: PropTypes.bool,
|
306
|
-
children: PropTypes.any.isRequired,
|
307
|
-
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
308
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
309
|
-
customPageNumber: PropTypes.number,
|
310
|
-
onScrollUnavailable: PropTypes.func,
|
311
|
-
onChange: PropTypes.func,
|
312
|
-
renderAllPagesOnFirstRender: PropTypes.bool,
|
313
|
-
transitionTimingFunction: PropTypes.string,
|
314
|
-
};
|
315
|
-
|
316
|
-
PageScroller.defaultProps = {
|
317
|
-
animationTimer: DEFAULT_ANIMATION_TIMER,
|
318
|
-
transitionTimingFunction: DEFAULT_ANIMATION,
|
319
|
-
height: DEFAULT_CONTAINER_HEIGHT,
|
320
|
-
width: DEFAULT_CONTAINER_WIDTH,
|
321
|
-
onChange: undefined,
|
322
|
-
onScrollUnavailable: undefined,
|
323
|
-
blockScrollUp: false,
|
324
|
-
blockScrollDown: false,
|
325
|
-
renderAllPagesOnFirstRender: false,
|
326
|
-
customPageNumber: undefined,
|
327
|
-
};
|
328
|
-
|
329
316
|
export default withDeprecated(PageScroller, { name: 'PageScroller' });
|
@@ -1,8 +1,7 @@
|
|
1
|
-
// eslint-disable-next-line no-unused-vars
|
2
1
|
import { useEffect, useRef } from 'react';
|
3
2
|
|
4
|
-
export default function usePrevious(value) {
|
5
|
-
const ref = useRef(
|
3
|
+
export default function usePrevious<T>(value: T) {
|
4
|
+
const ref = useRef<T>();
|
6
5
|
|
7
6
|
useEffect(() => {
|
8
7
|
ref.current = value;
|
@@ -1,12 +1,31 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
1
|
import upperFirst from 'lodash/upperFirst';
|
3
|
-
import { Box } from '@mui/material';
|
2
|
+
import { Box, type BoxProps } from '@mui/material';
|
4
3
|
import RevokeIcon from '@arcblock/icons/lib/RevokeIcon';
|
5
4
|
|
6
5
|
import NFTDisplay from '../NFTDisplay';
|
7
6
|
import { useLocaleContext } from '../Locale/context';
|
7
|
+
import { Passport as PassportType, User } from '../type';
|
8
8
|
|
9
|
-
export
|
9
|
+
export interface PassportProps extends BoxProps {
|
10
|
+
passport: PassportType;
|
11
|
+
user: User;
|
12
|
+
color: string;
|
13
|
+
width?: number;
|
14
|
+
icon?: React.ReactNode;
|
15
|
+
createPassportSvg: (props: any) => string;
|
16
|
+
}
|
17
|
+
|
18
|
+
export default function Passport({
|
19
|
+
passport,
|
20
|
+
user,
|
21
|
+
color,
|
22
|
+
width = 150,
|
23
|
+
icon = null,
|
24
|
+
createPassportSvg,
|
25
|
+
// inherit props
|
26
|
+
children,
|
27
|
+
...rest
|
28
|
+
}: PassportProps) {
|
10
29
|
const { t } = useLocaleContext();
|
11
30
|
return (
|
12
31
|
<Box
|
@@ -97,19 +116,3 @@ export default function Passport({ passport, user, color, width, icon, children,
|
|
97
116
|
</Box>
|
98
117
|
);
|
99
118
|
}
|
100
|
-
|
101
|
-
Passport.propTypes = {
|
102
|
-
passport: PropTypes.any.isRequired,
|
103
|
-
user: PropTypes.any.isRequired,
|
104
|
-
color: PropTypes.string.isRequired,
|
105
|
-
createPassportSvg: PropTypes.func.isRequired,
|
106
|
-
icon: PropTypes.any,
|
107
|
-
children: PropTypes.any,
|
108
|
-
width: PropTypes.number,
|
109
|
-
};
|
110
|
-
|
111
|
-
Passport.defaultProps = {
|
112
|
-
icon: null,
|
113
|
-
children: null,
|
114
|
-
width: 150,
|
115
|
-
};
|
@@ -1,7 +1,10 @@
|
|
1
|
-
import
|
2
|
-
import { Link, Typography } from '@mui/material';
|
1
|
+
import { Link, Typography, type TypographyProps, type LinkProps } from '@mui/material';
|
3
2
|
|
4
|
-
export
|
3
|
+
export interface PoweredByArcBlockProps extends TypographyProps {
|
4
|
+
linkProps?: LinkProps;
|
5
|
+
}
|
6
|
+
|
7
|
+
export default function PoweredByArcBlock({ linkProps, ...props }: PoweredByArcBlockProps) {
|
5
8
|
return (
|
6
9
|
<Typography {...props}>
|
7
10
|
Powered by{' '}
|
@@ -16,11 +19,3 @@ export default function PoweredByArcBlock({ linkProps, ...props }) {
|
|
16
19
|
</Typography>
|
17
20
|
);
|
18
21
|
}
|
19
|
-
|
20
|
-
PoweredByArcBlock.propTypes = {
|
21
|
-
linkProps: PropTypes.object,
|
22
|
-
};
|
23
|
-
|
24
|
-
PoweredByArcBlock.defaultProps = {
|
25
|
-
linkProps: {},
|
26
|
-
};
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
1
|
import Card from '@mui/material/Card';
|
3
2
|
import Button from '@mui/material/Button';
|
4
3
|
import CardContent from '@mui/material/CardContent';
|
@@ -6,7 +5,18 @@ import Typography from '@mui/material/Typography';
|
|
6
5
|
|
7
6
|
import { styled } from '../Theme';
|
8
7
|
|
9
|
-
|
8
|
+
export interface PricingPlanProps {
|
9
|
+
plan: {
|
10
|
+
name: string;
|
11
|
+
price: string;
|
12
|
+
featureList: string[];
|
13
|
+
showButton: boolean;
|
14
|
+
buttonLink: string;
|
15
|
+
buttonText: string;
|
16
|
+
};
|
17
|
+
}
|
18
|
+
|
19
|
+
function PricingPlan({ plan }: PricingPlanProps) {
|
10
20
|
return (
|
11
21
|
<PlanCard $shadow>
|
12
22
|
<div className="card-header">
|
@@ -41,11 +51,11 @@ function PricingPlan({ plan }) {
|
|
41
51
|
|
42
52
|
export default PricingPlan;
|
43
53
|
|
44
|
-
|
45
|
-
|
54
|
+
type PlanCardProps = {
|
55
|
+
$shadow?: boolean;
|
46
56
|
};
|
47
57
|
|
48
|
-
const PlanCard = styled(Card)
|
58
|
+
const PlanCard = styled(Card)<PlanCardProps>`
|
49
59
|
height: 500px;
|
50
60
|
display: flex;
|
51
61
|
flex-direction: column;
|
@@ -1,11 +1,14 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
1
|
import Grid from '@mui/material/Grid';
|
3
2
|
|
4
|
-
import PricingPlan from './PricingPlan';
|
3
|
+
import PricingPlan, { type PricingPlanProps } from './PricingPlan';
|
5
4
|
import { styled } from '../Theme';
|
6
5
|
import { withDeprecated } from '../Util/deprecate';
|
7
6
|
|
8
|
-
|
7
|
+
export interface PricingTableProps {
|
8
|
+
plans?: Array<PricingPlanProps['plan']>;
|
9
|
+
}
|
10
|
+
|
11
|
+
function PricingTable({ plans = [] }: PricingTableProps) {
|
9
12
|
if (plans && plans.length > 0) {
|
10
13
|
return (
|
11
14
|
<Div variant="even">
|
@@ -25,11 +28,11 @@ function PricingTable({ plans }) {
|
|
25
28
|
|
26
29
|
export default withDeprecated(PricingTable, { name: 'PricingTable' });
|
27
30
|
|
28
|
-
|
29
|
-
|
31
|
+
type DivProps = {
|
32
|
+
variant: 'even' | 'odd';
|
30
33
|
};
|
31
34
|
|
32
|
-
const Div = styled('div')
|
35
|
+
const Div = styled('div')<DivProps>`
|
33
36
|
padding: 100px 0;
|
34
37
|
text-align: center;
|
35
38
|
background-color: ${(props) => (props.variant === 'even' ? '#fbfbfb' : '#ffffff')};
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { useRef, useEffect, useMemo, useState } from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
2
|
import QRCodeStyling from '@solana/qr-code-styling';
|
4
3
|
import { Box } from '@mui/material';
|
5
4
|
|
6
|
-
|
5
|
+
type QRCodeStylingOptions = NonNullable<ConstructorParameters<typeof QRCodeStyling>[0]>;
|
6
|
+
|
7
|
+
const defaults: QRCodeStylingOptions = {
|
7
8
|
margin: 0,
|
8
9
|
dotsOptions: {
|
9
10
|
type: 'dots',
|
@@ -16,9 +17,18 @@ const defaults = {
|
|
16
17
|
},
|
17
18
|
};
|
18
19
|
|
20
|
+
export interface QRCodeProps {
|
21
|
+
/** 一般情况下仅使用 data/size/image 即可 */
|
22
|
+
data: string;
|
23
|
+
size: number;
|
24
|
+
image?: string;
|
25
|
+
/** 覆盖 qr-code-styling 配置 */
|
26
|
+
config?: QRCodeStylingOptions;
|
27
|
+
}
|
28
|
+
|
19
29
|
// 该组件用于生成与 android wallet 样式风格相似的 qrcode
|
20
30
|
// 注意: 依赖的 @solana/qr-code-styling 是一份 fork 版本, 原版本的 margin 配置存在 bug
|
21
|
-
function QRCode({ data, size, image, config, ...rest }) {
|
31
|
+
function QRCode({ data, size, image, config = {}, ...rest }: QRCodeProps) {
|
22
32
|
const ref = useRef(null);
|
23
33
|
const options = useMemo(() => {
|
24
34
|
return {
|
@@ -54,18 +64,4 @@ function QRCode({ data, size, image, config, ...rest }) {
|
|
54
64
|
return <Box ref={ref} {...rest} />;
|
55
65
|
}
|
56
66
|
|
57
|
-
QRCode.propTypes = {
|
58
|
-
// 一般情况下仅使用 data/size/image 即可
|
59
|
-
data: PropTypes.string.isRequired,
|
60
|
-
size: PropTypes.number.isRequired,
|
61
|
-
image: PropTypes.string,
|
62
|
-
// 覆盖 qr-code-styling 配置
|
63
|
-
config: PropTypes.object,
|
64
|
-
};
|
65
|
-
|
66
|
-
QRCode.defaultProps = {
|
67
|
-
image: null,
|
68
|
-
config: {},
|
69
|
-
};
|
70
|
-
|
71
67
|
export default QRCode;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
1
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
3
2
|
import dayjs from 'dayjs';
|
4
3
|
import 'dayjs/locale/zh-cn';
|
@@ -8,6 +7,7 @@ import utc from 'dayjs/plugin/utc';
|
|
8
7
|
import timezone from 'dayjs/plugin/timezone';
|
9
8
|
import updateLocale from 'dayjs/plugin/updateLocale';
|
10
9
|
import { formatToDatetime, setDateTool } from '../Util';
|
10
|
+
import type { Locale } from '../type';
|
11
11
|
|
12
12
|
dayjs.extend(localizedFormat);
|
13
13
|
dayjs.extend(utc);
|
@@ -34,7 +34,28 @@ dayjs.updateLocale('zh-cn', {
|
|
34
34
|
});
|
35
35
|
setDateTool(dayjs);
|
36
36
|
|
37
|
-
export
|
37
|
+
export interface RelativeTimeProps {
|
38
|
+
value: string | number;
|
39
|
+
locale?: Locale;
|
40
|
+
withoutSuffix?: false | true;
|
41
|
+
from?: string | number;
|
42
|
+
to?: string | number;
|
43
|
+
type?: 'relative' | 'absolute';
|
44
|
+
tz?: string;
|
45
|
+
relativeRange?: number;
|
46
|
+
}
|
47
|
+
|
48
|
+
export default function RelativeTime({
|
49
|
+
value,
|
50
|
+
locale = 'en',
|
51
|
+
withoutSuffix = false,
|
52
|
+
from = '',
|
53
|
+
to = '',
|
54
|
+
type = 'relative',
|
55
|
+
tz,
|
56
|
+
relativeRange,
|
57
|
+
...rest
|
58
|
+
}: RelativeTimeProps) {
|
38
59
|
if (!value) {
|
39
60
|
return '-';
|
40
61
|
}
|
@@ -46,7 +67,7 @@ export default function RelativeTime({ value, locale, withoutSuffix, from, to, t
|
|
46
67
|
datetime.tz(tz);
|
47
68
|
}
|
48
69
|
|
49
|
-
const absoluteString = formatToDatetime(value, { locale: localeOption, tz });
|
70
|
+
const absoluteString = formatToDatetime(value.toString(), { locale: localeOption, tz });
|
50
71
|
|
51
72
|
let relativeString;
|
52
73
|
|
@@ -79,24 +100,3 @@ export default function RelativeTime({ value, locale, withoutSuffix, from, to, t
|
|
79
100
|
</Tooltip>
|
80
101
|
);
|
81
102
|
}
|
82
|
-
|
83
|
-
RelativeTime.propTypes = {
|
84
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
85
|
-
locale: PropTypes.string,
|
86
|
-
withoutSuffix: PropTypes.bool,
|
87
|
-
from: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
88
|
-
to: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
89
|
-
type: PropTypes.oneOf(['relative', 'absolute']),
|
90
|
-
tz: PropTypes.string,
|
91
|
-
relativeRange: PropTypes.number,
|
92
|
-
};
|
93
|
-
|
94
|
-
RelativeTime.defaultProps = {
|
95
|
-
locale: 'en',
|
96
|
-
withoutSuffix: false,
|
97
|
-
from: '',
|
98
|
-
to: '',
|
99
|
-
type: 'relative',
|
100
|
-
tz: undefined,
|
101
|
-
relativeRange: undefined,
|
102
|
-
};
|
@@ -2,27 +2,31 @@
|
|
2
2
|
/* eslint-disable no-param-reassign */
|
3
3
|
import InfoIcon from '@mui/icons-material/Info';
|
4
4
|
import CancelRoundedIcon from '@mui/icons-material/CancelRounded';
|
5
|
-
import
|
5
|
+
import { type SvgIconProps } from '@mui/material';
|
6
|
+
import Result, { type ResultProps } from './result';
|
6
7
|
import translations from './translations';
|
7
8
|
import { useLocaleContext } from '../Locale/context';
|
8
9
|
import { useTheme } from '../Theme';
|
10
|
+
import type { Locale } from '../type';
|
9
11
|
|
10
12
|
// 优先使用显式指定的 locale, 再尝试使用 context 中的 locale, 最后使用默认 'en'
|
11
|
-
const useLocale = (locale) => {
|
13
|
+
const useLocale = (locale: Locale) => {
|
12
14
|
locale = ['zh', 'en'].includes(locale) ? locale : '';
|
13
15
|
const { locale: localeFromContext } = useLocaleContext() || { locale: 'en' };
|
14
16
|
const result = locale || localeFromContext;
|
15
17
|
return translations[result] ? result : 'en';
|
16
18
|
};
|
17
19
|
|
20
|
+
export type CommonResultProps = { locale: Locale } & Omit<ResultProps, 'icon' | 'title' | 'description'>;
|
21
|
+
|
18
22
|
// 404
|
19
|
-
export function PageNotFound({ locale, ...rest }) {
|
23
|
+
export function PageNotFound({ locale, ...rest }: CommonResultProps) {
|
20
24
|
locale = useLocale(locale);
|
21
25
|
return (
|
22
26
|
<Result
|
23
27
|
icon={<StyledErrorIcon />}
|
24
|
-
title={translations[locale][404].title}
|
25
|
-
description={translations[locale][404].description}
|
28
|
+
title={translations[locale]['404'].title}
|
29
|
+
description={translations[locale]['404'].description}
|
26
30
|
{...rest}
|
27
31
|
/>
|
28
32
|
);
|
@@ -30,7 +34,7 @@ export function PageNotFound({ locale, ...rest }) {
|
|
30
34
|
PageNotFound.status = '404';
|
31
35
|
|
32
36
|
// 403
|
33
|
-
export function Forbidden({ locale, ...rest }) {
|
37
|
+
export function Forbidden({ locale, ...rest }: CommonResultProps) {
|
34
38
|
locale = useLocale(locale);
|
35
39
|
return (
|
36
40
|
<Result
|
@@ -44,7 +48,7 @@ export function Forbidden({ locale, ...rest }) {
|
|
44
48
|
Forbidden.status = '403';
|
45
49
|
|
46
50
|
// 500
|
47
|
-
export function InternalServerError({ locale, ...rest }) {
|
51
|
+
export function InternalServerError({ locale, ...rest }: CommonResultProps) {
|
48
52
|
locale = useLocale(locale);
|
49
53
|
return (
|
50
54
|
<Result
|
@@ -58,7 +62,7 @@ export function InternalServerError({ locale, ...rest }) {
|
|
58
62
|
InternalServerError.status = '500';
|
59
63
|
|
60
64
|
// 通用错误
|
61
|
-
export function Error({ locale, ...rest }) {
|
65
|
+
export function Error({ locale, ...rest }: CommonResultProps) {
|
62
66
|
locale = useLocale(locale);
|
63
67
|
return (
|
64
68
|
<Result
|
@@ -72,7 +76,7 @@ export function Error({ locale, ...rest }) {
|
|
72
76
|
Error.status = 'error';
|
73
77
|
|
74
78
|
// under maintenance
|
75
|
-
export function Maintenance({ locale, ...rest }) {
|
79
|
+
export function Maintenance({ locale, ...rest }: CommonResultProps) {
|
76
80
|
locale = useLocale(locale);
|
77
81
|
return (
|
78
82
|
<Result
|
@@ -86,7 +90,7 @@ export function Maintenance({ locale, ...rest }) {
|
|
86
90
|
Maintenance.status = 'maintenance';
|
87
91
|
|
88
92
|
// coming soon
|
89
|
-
export function ComingSoon({ locale, ...rest }) {
|
93
|
+
export function ComingSoon({ locale, ...rest }: CommonResultProps) {
|
90
94
|
locale = useLocale(locale);
|
91
95
|
return (
|
92
96
|
<Result
|
@@ -100,17 +104,17 @@ export function ComingSoon({ locale, ...rest }) {
|
|
100
104
|
ComingSoon.status = 'comingSoon';
|
101
105
|
|
102
106
|
// info, 与其它 status 不同, title/description 需要使用方自己传入
|
103
|
-
export function Info(props) {
|
107
|
+
export function Info(props: Omit<ResultProps, 'icon'>) {
|
104
108
|
return <Result icon={<StyledInfoIcon />} {...props} />;
|
105
109
|
}
|
106
110
|
Info.status = 'info';
|
107
111
|
|
108
|
-
function StyledErrorIcon(props) {
|
112
|
+
function StyledErrorIcon(props: SvgIconProps) {
|
109
113
|
const theme = useTheme();
|
110
114
|
return <CancelRoundedIcon style={{ color: theme.palette.error.main, fontSize: 72 }} {...props} />;
|
111
115
|
}
|
112
116
|
|
113
|
-
function StyledInfoIcon(props) {
|
117
|
+
function StyledInfoIcon(props: SvgIconProps) {
|
114
118
|
const theme = useTheme();
|
115
119
|
return <InfoIcon style={{ color: theme.palette.info.main, fontSize: 72 }} {...props} />;
|
116
120
|
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import Result, { type ResultProps } from './result';
|
2
|
+
import * as common from './common';
|
3
|
+
|
4
|
+
type ComponentNames = keyof typeof common;
|
5
|
+
|
6
|
+
const componentsKeyByStatus = Object.keys(common).reduce<Record<string, React.ComponentType<ResultProps>>>(
|
7
|
+
(acc, cur) => ({ ...acc, [common[cur as ComponentNames].status || cur]: common[cur as ComponentNames] as any }),
|
8
|
+
{}
|
9
|
+
);
|
10
|
+
|
11
|
+
export interface ResultWrapperProps extends ResultProps {
|
12
|
+
status?: string | number;
|
13
|
+
}
|
14
|
+
|
15
|
+
function ResultWrapper({ status = '', ...rest }: ResultWrapperProps) {
|
16
|
+
if (status) {
|
17
|
+
if (componentsKeyByStatus[status]) {
|
18
|
+
const Component = componentsKeyByStatus[status];
|
19
|
+
return <Component {...rest} />;
|
20
|
+
}
|
21
|
+
throw new Error(
|
22
|
+
`Please provide a valid status for Result.status. Valid values are: ${Object.keys(componentsKeyByStatus).join(
|
23
|
+
', '
|
24
|
+
)}`
|
25
|
+
);
|
26
|
+
}
|
27
|
+
return <Result {...rest} />;
|
28
|
+
}
|
29
|
+
|
30
|
+
export default ResultWrapper;
|
@@ -1,9 +1,15 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
1
|
import Box from '@mui/material/Box';
|
3
2
|
|
4
3
|
import { styled } from '../Theme';
|
5
4
|
|
6
|
-
|
5
|
+
export interface ResultProps {
|
6
|
+
icon?: React.ReactNode;
|
7
|
+
title?: React.ReactNode;
|
8
|
+
description?: React.ReactNode;
|
9
|
+
extra?: React.ReactNode;
|
10
|
+
}
|
11
|
+
|
12
|
+
function Result({ icon, title = '', description = '', extra, ...rest }: ResultProps) {
|
7
13
|
return (
|
8
14
|
<Root {...rest}>
|
9
15
|
{icon}
|
@@ -28,21 +34,6 @@ function Result({ icon, title, description, extra, ...rest }) {
|
|
28
34
|
);
|
29
35
|
}
|
30
36
|
|
31
|
-
Result.propTypes = {
|
32
|
-
icon: PropTypes.element,
|
33
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
34
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
35
|
-
actions: PropTypes.any,
|
36
|
-
extra: PropTypes.element,
|
37
|
-
};
|
38
|
-
Result.defaultProps = {
|
39
|
-
icon: undefined,
|
40
|
-
title: '',
|
41
|
-
description: '',
|
42
|
-
actions: null,
|
43
|
-
extra: undefined,
|
44
|
-
};
|
45
|
-
|
46
37
|
const Root = styled('div')`
|
47
38
|
box-sizing: border-box;
|
48
39
|
display: flex;
|