@arcblock/ux 3.4.15 → 3.5.1
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/lib/package.json.js +1 -1
- package/package.json +10 -7
- package/src/ActionButton/ActionButton.stories.jsx +0 -61
- package/src/ActionButton/index.jsx +0 -106
- package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
- package/src/ActivityIndicator/index.jsx +0 -140
- package/src/Address/Address.stories.jsx +0 -38
- package/src/Address/compact-text.jsx +0 -76
- package/src/Address/did-address.tsx +0 -223
- package/src/Address/index.tsx +0 -21
- package/src/Address/responsive-did-address.tsx +0 -154
- package/src/Alert/Alert.stories.jsx +0 -100
- package/src/Alert/index.jsx +0 -130
- package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
- package/src/AnimationWaiter/dark-animation.json +0 -1
- package/src/AnimationWaiter/default-animation.json +0 -1
- package/src/AnimationWaiter/index.jsx +0 -296
- package/src/Async/index.tsx +0 -44
- package/src/Avatar/Avatar.stories.jsx +0 -11
- package/src/Avatar/did-motif.jsx +0 -38
- package/src/Avatar/etherscan-blockies.js +0 -81
- package/src/Avatar/index.jsx +0 -195
- package/src/Badge/Badge.stories.jsx +0 -41
- package/src/Badge/index.jsx +0 -101
- package/src/Blocklet/Blocklet.stories.jsx +0 -21
- package/src/Blocklet/blocklet.jsx +0 -276
- package/src/Blocklet/index.js +0 -5
- package/src/Blocklet/utils.jsx +0 -58
- package/src/BlockletContext/index.tsx +0 -72
- package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
- package/src/BlockletNFT/index.jsx +0 -378
- package/src/BlockletV2/Blocklet.stories.jsx +0 -34
- package/src/BlockletV2/blocklet.tsx +0 -247
- package/src/BlockletV2/components/icon-text.tsx +0 -47
- package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
- package/src/BlockletV2/index.ts +0 -6
- package/src/BlockletV2/utils.js +0 -75
- package/src/Button/Button.stories.jsx +0 -24
- package/src/Button/index.js +0 -9
- package/src/Button/wrap.jsx +0 -126
- package/src/ButtonGroup/index.js +0 -16
- package/src/CardSelector/index.tsx +0 -136
- package/src/Center/Center.stories.jsx +0 -20
- package/src/Center/index.tsx +0 -33
- package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
- package/src/ClickToCopy/copy-button.tsx +0 -43
- package/src/ClickToCopy/hook.ts +0 -42
- package/src/ClickToCopy/index.tsx +0 -96
- package/src/CloseButton/index.tsx +0 -37
- package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
- package/src/CodeBlock/LightBox.tsx +0 -87
- package/src/CodeBlock/index.tsx +0 -217
- package/src/Colors/Colors.stories.jsx +0 -211
- package/src/Colors/index.ts +0 -4
- package/src/Colors/themes/default.ts +0 -8
- package/src/Colors/themes/did-connect.ts +0 -64
- package/src/Colors/themes/temp.ts +0 -52
- package/src/Config/Config.stories.jsx +0 -16
- package/src/Config/config-provider.tsx +0 -62
- package/src/Config/index.ts +0 -2
- package/src/Config/theme-mode-toggle.tsx +0 -38
- package/src/ContactForm/ContactForm.stories.jsx +0 -32
- package/src/ContactForm/index.tsx +0 -264
- package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
- package/src/CookieConsent/index.tsx +0 -104
- package/src/CountDown/CountDown.stories.jsx +0 -15
- package/src/CountDown/index.tsx +0 -170
- package/src/DID/DID.stories.jsx +0 -37
- package/src/DID/index.tsx +0 -393
- package/src/DIDConnect/app-icon.tsx +0 -37
- package/src/DIDConnect/app-info-item.tsx +0 -93
- package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
- package/src/DIDConnect/auth-apps/index.tsx +0 -278
- package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
- package/src/DIDConnect/did-connect-container.tsx +0 -326
- package/src/DIDConnect/did-connect-footer.tsx +0 -76
- package/src/DIDConnect/did-connect-logo.tsx +0 -8
- package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
- package/src/DIDConnect/icons/github-logo.tsx +0 -17
- package/src/DIDConnect/index.ts +0 -11
- package/src/DIDConnect/landing-page.tsx +0 -218
- package/src/DIDConnect/powered-by.tsx +0 -48
- package/src/DIDConnect/provider-icon.tsx +0 -62
- package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
- package/src/DIDConnect/with-container.tsx +0 -323
- package/src/DIDConnect/with-ux-theme.tsx +0 -22
- package/src/DIDLogo/Logo.stories.jsx +0 -11
- package/src/DIDLogo/index.tsx +0 -168
- package/src/Datatable/CustomToolbar.jsx +0 -415
- package/src/Datatable/Datatable.stories.jsx +0 -92
- package/src/Datatable/DatatableContext.jsx +0 -35
- package/src/Datatable/TableSearch.jsx +0 -166
- package/src/Datatable/index.jsx +0 -652
- package/src/Datatable/utils.js +0 -161
- package/src/Dialog/Dialog.stories.jsx +0 -21
- package/src/Dialog/confirm.jsx +0 -143
- package/src/Dialog/dialog.jsx +0 -199
- package/src/Dialog/index.js +0 -4
- package/src/Dialog/types.d.ts +0 -20
- package/src/Dialog/use-confirm.jsx +0 -188
- package/src/DriftBot/index.tsx +0 -81
- package/src/Earth/Earth.stories.jsx +0 -39
- package/src/Earth/countries.json +0 -8057
- package/src/Earth/index.tsx +0 -515
- package/src/Earth/util.ts +0 -72
- package/src/Empty/Empty.stories.jsx +0 -23
- package/src/Empty/index.jsx +0 -48
- package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
- package/src/ErrorBoundary/fallback.tsx +0 -85
- package/src/ErrorBoundary/index.ts +0 -1
- package/src/Footer/Footer.stories.jsx +0 -13
- package/src/Footer/index.tsx +0 -130
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/addon-button.tsx +0 -41
- package/src/Header/auto-hidden.tsx +0 -31
- package/src/Header/header-addons.tsx +0 -37
- package/src/Header/header.tsx +0 -214
- package/src/Header/index.ts +0 -3
- package/src/Header/responsive-header.tsx +0 -145
- package/src/Icon/Icon.stories.jsx +0 -45
- package/src/Icon/image.tsx +0 -53
- package/src/Icon/index.tsx +0 -63
- package/src/Img/Img.stories.jsx +0 -17
- package/src/Img/index.jsx +0 -258
- package/src/InfoRow/InfoRow.stories.jsx +0 -14
- package/src/InfoRow/index.tsx +0 -91
- package/src/Layout/Layout.stories.jsx +0 -24
- package/src/Layout/dashboard/external-link.tsx +0 -59
- package/src/Layout/dashboard/full-page.tsx +0 -58
- package/src/Layout/dashboard/index.tsx +0 -260
- package/src/Layout/dashboard/sidebar.tsx +0 -198
- package/src/Layout/dashboard-legacy/header.tsx +0 -156
- package/src/Layout/dashboard-legacy/index.tsx +0 -127
- package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
- package/src/Layout/index.tsx +0 -310
- package/src/LoadingMask/index.tsx +0 -108
- package/src/Locale/LocaleSelector.stories.jsx +0 -44
- package/src/Locale/browser-lang.ts +0 -65
- package/src/Locale/context.tsx +0 -162
- package/src/Locale/languages.ts +0 -58
- package/src/Locale/selector.tsx +0 -174
- package/src/Locale/util.ts +0 -38
- package/src/Logo/Logo.stories.jsx +0 -23
- package/src/Logo/images/logo-dark-text.svg +0 -3
- package/src/Logo/images/logo-dark-top.svg +0 -6
- package/src/Logo/images/logo-light-text.svg +0 -3
- package/src/Logo/images/logo-light-top.svg +0 -6
- package/src/Logo/index.tsx +0 -58
- package/src/Metric/Metric.stories.jsx +0 -29
- package/src/Metric/index.tsx +0 -130
- package/src/MuiWrap/index.tsx +0 -10
- package/src/NFTDisplay/NFTBroken.svg +0 -34
- package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
- package/src/NFTDisplay/README.md +0 -59
- package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
- package/src/NFTDisplay/broken.tsx +0 -51
- package/src/NFTDisplay/displayApi.ts +0 -43
- package/src/NFTDisplay/index.tsx +0 -393
- package/src/NFTDisplay/loading.tsx +0 -16
- package/src/NFTDisplay/preview.tsx +0 -84
- package/src/NFTDisplay/render-svg.tsx +0 -21
- package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
- package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
- package/src/NavMenu/NavMenu.stories.jsx +0 -17
- package/src/NavMenu/images/OCAP.svg +0 -1
- package/src/NavMenu/images/abt-network.svg +0 -1
- package/src/NavMenu/images/ai-kit.svg +0 -1
- package/src/NavMenu/images/aigne-image-smith.svg +0 -1
- package/src/NavMenu/images/aigne.svg +0 -1
- package/src/NavMenu/images/aistro.png +0 -0
- package/src/NavMenu/images/arcsphere.svg +0 -1
- package/src/NavMenu/images/blocklet-framework.svg +0 -1
- package/src/NavMenu/images/blocklet-launcher.svg +0 -1
- package/src/NavMenu/images/blocklet-server.svg +0 -1
- package/src/NavMenu/images/blocklet-store.svg +0 -1
- package/src/NavMenu/images/creator-studio.svg +0 -1
- package/src/NavMenu/images/did-wallet.svg +0 -1
- package/src/NavMenu/images/did.svg +0 -1
- package/src/NavMenu/images/nft-studio.svg +0 -1
- package/src/NavMenu/images/payment-kit.png +0 -0
- package/src/NavMenu/images/vc.svg +0 -1
- package/src/NavMenu/images/web3-kit.svg +0 -1
- package/src/NavMenu/index.ts +0 -3
- package/src/NavMenu/nav-menu-context.tsx +0 -30
- package/src/NavMenu/nav-menu.tsx +0 -441
- package/src/NavMenu/products.tsx +0 -830
- package/src/NavMenu/style.ts +0 -258
- package/src/NavMenu/sub-container.tsx +0 -125
- package/src/NavMenu/sub-item-group.tsx +0 -42
- package/src/OrgTransfer/index.tsx +0 -53
- package/src/OrgTransfer/locales.ts +0 -25
- package/src/OrgTransfer/selector.tsx +0 -252
- package/src/OrgTransfer/type.ts +0 -31
- package/src/PageScroller/index.tsx +0 -316
- package/src/PageScroller/story/FifthComponent.jsx +0 -7
- package/src/PageScroller/story/FirstComponent.jsx +0 -7
- package/src/PageScroller/story/FourthComponent.jsx +0 -7
- package/src/PageScroller/story/FullPage.jsx +0 -55
- package/src/PageScroller/story/PageContain.jsx +0 -59
- package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
- package/src/PageScroller/story/SecondComponent.jsx +0 -7
- package/src/PageScroller/story/ThirdComponent.jsx +0 -7
- package/src/PageScroller/story/index.css +0 -115
- package/src/PageScroller/usePrevValue.ts +0 -11
- package/src/Passport/index.ts +0 -3
- package/src/Passport/passport.tsx +0 -118
- package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
- package/src/PhoneInput/country-select.tsx +0 -148
- package/src/PhoneInput/index.tsx +0 -269
- package/src/PoweredByArcBlock/index.tsx +0 -27
- package/src/PricingTable/PricingPlan.tsx +0 -120
- package/src/PricingTable/PricingTable.stories.jsx +0 -38
- package/src/PricingTable/index.tsx +0 -59
- package/src/QRCode/QRCode.stories.jsx +0 -13
- package/src/QRCode/index.tsx +0 -66
- package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
- package/src/RelativeTime/index.tsx +0 -334
- package/src/Result/Result.stories.jsx +0 -61
- package/src/Result/common.tsx +0 -119
- package/src/Result/index.tsx +0 -30
- package/src/Result/result.tsx +0 -65
- package/src/Result/translations.ts +0 -57
- package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
- package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
- package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
- package/src/Screenshot/Screenshot.stories.jsx +0 -44
- package/src/Screenshot/devices.css +0 -1366
- package/src/Screenshot/index.tsx +0 -300
- package/src/SessionBlocklet/index.tsx +0 -178
- package/src/SessionManager/SessionManager.stories.jsx +0 -9
- package/src/SessionManager/index.tsx +0 -3
- package/src/SessionPermission/index.tsx +0 -26
- package/src/SessionUser/components/did-space.tsx +0 -68
- package/src/SessionUser/components/logged-in.tsx +0 -338
- package/src/SessionUser/components/quick-login-item.tsx +0 -132
- package/src/SessionUser/components/session-user-item.tsx +0 -93
- package/src/SessionUser/components/session-user-switch.tsx +0 -240
- package/src/SessionUser/components/un-login.tsx +0 -257
- package/src/SessionUser/components/user-info.tsx +0 -201
- package/src/SessionUser/index.tsx +0 -68
- package/src/SessionUser/libs/translation.ts +0 -30
- package/src/SessionUser/libs/utils.ts +0 -39
- package/src/SharedBridge/index.tsx +0 -126
- package/src/SocialShare/index.tsx +0 -194
- package/src/Sparkline/Sparkline.stories.jsx +0 -13
- package/src/Sparkline/index.tsx +0 -231
- package/src/Spinner/Spinner.stories.jsx +0 -98
- package/src/Spinner/index.tsx +0 -20
- package/src/SplitButton/SplitButton.stories.jsx +0 -32
- package/src/SplitButton/index.tsx +0 -116
- package/src/SplitButton/useClickAway.tsx +0 -24
- package/src/Success/index.tsx +0 -175
- package/src/Switch/Switch.stories.jsx +0 -16
- package/src/Switch/index.jsx +0 -79
- package/src/Tabs/Tabs.stories.jsx +0 -18
- package/src/Tabs/index.tsx +0 -255
- package/src/Tag/Tag.stories.jsx +0 -15
- package/src/Tag/index.jsx +0 -106
- package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
- package/src/TextCollapse/index.tsx +0 -85
- package/src/Theme/Theme.stories.jsx +0 -11
- package/src/Theme/index.ts +0 -21
- package/src/Theme/theme-provider.tsx +0 -374
- package/src/Theme/theme.ts +0 -229
- package/src/Toast/Toast.stories.jsx +0 -28
- package/src/Toast/index.tsx +0 -80
- package/src/Typography/index.tsx +0 -124
- package/src/UserCard/Cards/avatar-only.tsx +0 -27
- package/src/UserCard/Cards/basic-info.tsx +0 -43
- package/src/UserCard/Cards/index.tsx +0 -16
- package/src/UserCard/Cards/social-actions.tsx +0 -196
- package/src/UserCard/Container/card.tsx +0 -63
- package/src/UserCard/Container/dialog.tsx +0 -37
- package/src/UserCard/Content/basic.tsx +0 -330
- package/src/UserCard/Content/clock.tsx +0 -82
- package/src/UserCard/Content/minimal.tsx +0 -113
- package/src/UserCard/Content/shorten-label.tsx +0 -32
- package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
- package/src/UserCard/UserCard.stories.jsx +0 -19
- package/src/UserCard/components.tsx +0 -81
- package/src/UserCard/index.tsx +0 -132
- package/src/UserCard/types.ts +0 -165
- package/src/UserCard/use-follow.tsx +0 -111
- package/src/UserCard/utils.ts +0 -155
- package/src/Util/WebWalletOpener.stories.jsx +0 -5
- package/src/Util/client.ts +0 -4
- package/src/Util/constant.ts +0 -70
- package/src/Util/deprecate.tsx +0 -29
- package/src/Util/federated.ts +0 -125
- package/src/Util/iframe.ts +0 -19
- package/src/Util/index.ts +0 -760
- package/src/Util/logger.ts +0 -44
- package/src/Util/passport.ts +0 -127
- package/src/Util/security.ts +0 -72
- package/src/Util/style.ts +0 -17
- package/src/Util/wallet.ts +0 -35
- package/src/VerificationCode/index.tsx +0 -83
- package/src/Video/Video.stories.jsx +0 -6
- package/src/Video/index.tsx +0 -70
- package/src/Wallet/Action.stories.jsx +0 -8
- package/src/Wallet/Action.tsx +0 -118
- package/src/Wallet/Download.stories.jsx +0 -9
- package/src/Wallet/Download.tsx +0 -157
- package/src/Wallet/Open.tsx +0 -47
- package/src/Wallet/OpenInWallet.stories.jsx +0 -5
- package/src/Wallet/images/abtwallet.png +0 -0
- package/src/Wallet/images/android_download.svg +0 -22
- package/src/Wallet/images/app-store.svg +0 -30
- package/src/Wallet/images/google-play.svg +0 -69
- package/src/WalletOSIcon/index.tsx +0 -47
- package/src/WebWalletSWKeeper/index.tsx +0 -117
- package/src/WechatPrompt/images/android.png +0 -0
- package/src/WechatPrompt/images/ios.png +0 -0
- package/src/WechatPrompt/index.tsx +0 -75
- package/src/global.d.ts +0 -28
- package/src/hooks/use-blocklet-logo.tsx +0 -32
- package/src/hooks/use-clock.tsx +0 -62
- package/src/hooks/use-location-state.tsx +0 -117
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -79
- package/src/type.d.ts +0 -44
- package/src/withTheme/index.tsx +0 -72
- package/src/withTracker/README.md +0 -37
- package/src/withTracker/action/bind-wallet.tsx +0 -17
- package/src/withTracker/action/login.tsx +0 -18
- package/src/withTracker/action/pay.tsx +0 -14
- package/src/withTracker/action/switch-passport.tsx +0 -20
- package/src/withTracker/constant/index.tsx +0 -3
- package/src/withTracker/env.tsx +0 -1
- package/src/withTracker/error_boundary.jsx +0 -34
- package/src/withTracker/index.tsx +0 -50
- package/src/withTracker/libs/utm.ts +0 -46
- package/vite.config.mjs +0 -37
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Portal, Typography, CircularProgress, useMediaQuery } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
import Avatar from '../Avatar';
|
|
6
|
-
import Icon from '../Icon';
|
|
7
|
-
import Button from '../Button';
|
|
8
|
-
import Img from '../Img';
|
|
9
|
-
import { useTheme, styled } from '../Theme';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 美化数字 1000-->1k
|
|
13
|
-
* @param {*} _size
|
|
14
|
-
* @param {*} digits
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
function prettySize(_size, digits = 1) {
|
|
18
|
-
let size = _size;
|
|
19
|
-
const list = ['', 'k', 'm', 'b'];
|
|
20
|
-
let index = 0;
|
|
21
|
-
while (size > 1000 && index < list.length - 1) {
|
|
22
|
-
size = (size / 1000).toFixed(digits);
|
|
23
|
-
index += 1;
|
|
24
|
-
}
|
|
25
|
-
return _size && `${size}${list[index]}`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const Div = styled('div')`
|
|
29
|
-
&.arcblock-blocklet {
|
|
30
|
-
padding: 0 16px;
|
|
31
|
-
background: ${(props) => props.theme.palette.common.white};
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
box-shadow: 0px 0px 8px #f0f0f0;
|
|
34
|
-
&:hover {
|
|
35
|
-
box-shadow: 0px 2px 12px #f0f0f0;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
.arcblock-blocklet__content {
|
|
39
|
-
padding: 16px 0 0 0;
|
|
40
|
-
}
|
|
41
|
-
.arcblock-blocklet__content--main {
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
}
|
|
46
|
-
.arcblock-blocklet__content--body {
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
flex: 1;
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: flex-start;
|
|
51
|
-
}
|
|
52
|
-
.arcblock-blocklet__addons {
|
|
53
|
-
padding: 16px 0;
|
|
54
|
-
}
|
|
55
|
-
.arcblock-blocklet__cover {
|
|
56
|
-
width: 80px;
|
|
57
|
-
height: 80px;
|
|
58
|
-
margin-right: 12px;
|
|
59
|
-
overflow: hidden;
|
|
60
|
-
border-radius: 12px;
|
|
61
|
-
/* see: https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari */
|
|
62
|
-
transform: translateZ(0);
|
|
63
|
-
}
|
|
64
|
-
.arcblock-blocklet__button--hover {
|
|
65
|
-
&:not(.Mui-disabled) {
|
|
66
|
-
position: relative;
|
|
67
|
-
z-index: 1;
|
|
68
|
-
&::before {
|
|
69
|
-
content: '';
|
|
70
|
-
position: absolute;
|
|
71
|
-
height: 100%;
|
|
72
|
-
width: 100%;
|
|
73
|
-
left: 0;
|
|
74
|
-
top: 0;
|
|
75
|
-
transition: opacity 0.3s;
|
|
76
|
-
}
|
|
77
|
-
&:hover::before {
|
|
78
|
-
opacity: 0;
|
|
79
|
-
}
|
|
80
|
-
&::after {
|
|
81
|
-
content: '';
|
|
82
|
-
position: absolute;
|
|
83
|
-
height: 100%;
|
|
84
|
-
width: 100%;
|
|
85
|
-
top: 0;
|
|
86
|
-
left: 0;
|
|
87
|
-
background-color: ${(props) => props.theme.palette.primary.main};
|
|
88
|
-
transform: scale(0.1);
|
|
89
|
-
opacity: 0;
|
|
90
|
-
z-index: -1;
|
|
91
|
-
transition:
|
|
92
|
-
transform 0.3s,
|
|
93
|
-
opacity 0.3s,
|
|
94
|
-
background-color 0.3s;
|
|
95
|
-
}
|
|
96
|
-
&:hover::after {
|
|
97
|
-
opacity: 1;
|
|
98
|
-
transform-origin: center;
|
|
99
|
-
transform: scale(1);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&:not(.Mui-disabled) {
|
|
104
|
-
background-color: transparent !important;
|
|
105
|
-
color: ${(props) => props.theme.palette.primary.main};
|
|
106
|
-
}
|
|
107
|
-
&:not(.Mui-disabled) {
|
|
108
|
-
&:hover {
|
|
109
|
-
color: ${(props) => props.theme.palette.common.white};
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
.arcblock-blocklet__info {
|
|
114
|
-
flex: 1;
|
|
115
|
-
overflow: hidden;
|
|
116
|
-
.arcblock-blocklet__button {
|
|
117
|
-
margin-top: 16px;
|
|
118
|
-
display: inline-block;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
.arcblock-blocklet__title {
|
|
122
|
-
margin: 0;
|
|
123
|
-
font-size: 18px;
|
|
124
|
-
font-weight: 600;
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
text-overflow: ellipsis;
|
|
127
|
-
white-space: nowrap;
|
|
128
|
-
}
|
|
129
|
-
.arcblock-blocklet__describe {
|
|
130
|
-
margin: 0 0 2px 0;
|
|
131
|
-
color: #999;
|
|
132
|
-
font-size: 14px;
|
|
133
|
-
overflow: hidden;
|
|
134
|
-
text-overflow: ellipsis;
|
|
135
|
-
white-space: nowrap;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.arcblock-blocklet__addons {
|
|
139
|
-
display: flex;
|
|
140
|
-
justify-content: space-between;
|
|
141
|
-
color: #999;
|
|
142
|
-
font-size: 14px;
|
|
143
|
-
position: relative;
|
|
144
|
-
}
|
|
145
|
-
.arcblock-blocklet__addons--item {
|
|
146
|
-
white-space: nowrap;
|
|
147
|
-
}
|
|
148
|
-
&.arcblock-blocklet--size-md {
|
|
149
|
-
&:hover {
|
|
150
|
-
position: relative;
|
|
151
|
-
}
|
|
152
|
-
.arcblock-blocklet__title {
|
|
153
|
-
height: 2.3em;
|
|
154
|
-
margin-bottom: 3px;
|
|
155
|
-
display: -webkit-box;
|
|
156
|
-
-webkit-box-orient: vertical;
|
|
157
|
-
-webkit-line-clamp: 2;
|
|
158
|
-
overflow: hidden;
|
|
159
|
-
text-overflow: initial;
|
|
160
|
-
white-space: initial;
|
|
161
|
-
word-break: break-all;
|
|
162
|
-
}
|
|
163
|
-
.arcblock-blocklet__describe {
|
|
164
|
-
white-space: normal;
|
|
165
|
-
height: 2.86em;
|
|
166
|
-
}
|
|
167
|
-
.arcblock-blocklet__button {
|
|
168
|
-
margin-top: 5px;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
&.arcblock-blocklet--size-sm,
|
|
172
|
-
&.arcblock-blocklet--size-xs {
|
|
173
|
-
.arcblock-blocklet__cover {
|
|
174
|
-
width: 40px;
|
|
175
|
-
height: 40px;
|
|
176
|
-
border-radius: 6px;
|
|
177
|
-
}
|
|
178
|
-
.arcblock-blocklet__content {
|
|
179
|
-
padding: 16px 0;
|
|
180
|
-
}
|
|
181
|
-
.arcblock-blocklet__addons {
|
|
182
|
-
padding: 8px 0;
|
|
183
|
-
.arcblock-blocklet__addons--item {
|
|
184
|
-
font-size: 12px;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
&.arcblock-blocklet--size-xs {
|
|
189
|
-
.arcblock-blocklet__addons {
|
|
190
|
-
display: none !important;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
`;
|
|
194
|
-
function BlockletIcon({ name }) {
|
|
195
|
-
return <Icon name={name} color="inherit" size={15} style={{ marginRight: 8 }} />;
|
|
196
|
-
}
|
|
197
|
-
BlockletIcon.propTypes = {
|
|
198
|
-
name: PropTypes.string.isRequired,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* BlockletNFT 组件
|
|
203
|
-
* @typedef {{
|
|
204
|
-
* title: string;
|
|
205
|
-
* description?: string;
|
|
206
|
-
* cover?: string;
|
|
207
|
-
* did?: string;
|
|
208
|
-
* isStickyButton?: false | true;
|
|
209
|
-
* buttonText?: string;
|
|
210
|
-
* buttonDisabled?: false | true;
|
|
211
|
-
* buttonLoading?: false | true;
|
|
212
|
-
* button?: JSX.Element;
|
|
213
|
-
* addons?: Array<any>;
|
|
214
|
-
* size?: 'xs' | 'sm' | 'md' | 'auto';
|
|
215
|
-
* onButtonClick?: Function;
|
|
216
|
-
* onMainClick?: Function;
|
|
217
|
-
* className?: string;
|
|
218
|
-
* scaleClickZone?: number;
|
|
219
|
-
* } & import('react').ComponentPropsWithoutRef<"div"> } BlockletNFTProps
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* BlockletNFT 组件
|
|
224
|
-
* @param {BlockletNFTProps} props
|
|
225
|
-
* @returns {JSX.Element}
|
|
226
|
-
*/
|
|
227
|
-
export default function BlockletNFT({
|
|
228
|
-
title,
|
|
229
|
-
did = undefined,
|
|
230
|
-
description = null,
|
|
231
|
-
cover = null,
|
|
232
|
-
size = 'auto',
|
|
233
|
-
addons = [],
|
|
234
|
-
button = null,
|
|
235
|
-
buttonText = 'Install',
|
|
236
|
-
buttonDisabled = false,
|
|
237
|
-
buttonLoading = false,
|
|
238
|
-
isStickyButton = false,
|
|
239
|
-
onButtonClick = null,
|
|
240
|
-
onMainClick = null,
|
|
241
|
-
className = null,
|
|
242
|
-
scaleClickZone = 1.5,
|
|
243
|
-
...rest
|
|
244
|
-
}) {
|
|
245
|
-
const wrapHandler =
|
|
246
|
-
(handler, stopFn = () => false) =>
|
|
247
|
-
(e, ...args) => {
|
|
248
|
-
if (stopFn()) {
|
|
249
|
-
e.preventDefault();
|
|
250
|
-
e.stopPropagation();
|
|
251
|
-
} else if (handler instanceof Function) {
|
|
252
|
-
e.preventDefault();
|
|
253
|
-
e.stopPropagation();
|
|
254
|
-
handler(...args);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
const _onButtonClick = wrapHandler(onButtonClick, () => {
|
|
258
|
-
// stop click while custom button or buttonDisabled or buttondLoading
|
|
259
|
-
if (button || buttonDisabled || buttonLoading) {
|
|
260
|
-
return true;
|
|
261
|
-
}
|
|
262
|
-
return false;
|
|
263
|
-
});
|
|
264
|
-
const _onMainClick = wrapHandler(onMainClick);
|
|
265
|
-
|
|
266
|
-
const theme = useTheme();
|
|
267
|
-
const isDownSm = useMediaQuery(theme.breakpoints.down('md'));
|
|
268
|
-
const isDownMd = useMediaQuery(theme.breakpoints.down('lg'));
|
|
269
|
-
const isUpLg = useMediaQuery(theme.breakpoints.up('lg'));
|
|
270
|
-
|
|
271
|
-
// If size is auto, need calculate actual size according to screen size
|
|
272
|
-
// eslint-disable-next-line no-nested-ternary
|
|
273
|
-
const actualSize = size === 'auto' ? (isDownSm ? 'xs' : isDownMd ? 'sm' : 'md') : size;
|
|
274
|
-
// eslint-disable-next-line no-nested-ternary
|
|
275
|
-
const didAvatarSize = size === 'auto' ? (isUpLg ? 80 : 40) : size === 'md' ? 80 : 40;
|
|
276
|
-
const container = useRef(null);
|
|
277
|
-
|
|
278
|
-
return (
|
|
279
|
-
<Div
|
|
280
|
-
{...rest}
|
|
281
|
-
scaleClickZone={scaleClickZone}
|
|
282
|
-
className={`${className} arcblock-blocklet arcblock-blocklet--size-${actualSize}`}>
|
|
283
|
-
<div className="arcblock-blocklet__content">
|
|
284
|
-
<div className="arcblock-blocklet__content--main" onClick={_onMainClick} ref={container}>
|
|
285
|
-
<div className="arcblock-blocklet__content--body">
|
|
286
|
-
{cover ? (
|
|
287
|
-
<div className="arcblock-blocklet__cover">
|
|
288
|
-
<Img src={cover} />
|
|
289
|
-
</div>
|
|
290
|
-
) : (
|
|
291
|
-
did && (
|
|
292
|
-
<div className="arcblock-blocklet__cover">
|
|
293
|
-
<Avatar did={did} size={didAvatarSize} />
|
|
294
|
-
</div>
|
|
295
|
-
)
|
|
296
|
-
)}
|
|
297
|
-
<div className="arcblock-blocklet__info">
|
|
298
|
-
<Typography component="h3" variant="h3" className="arcblock-blocklet__title" title={title}>
|
|
299
|
-
{title}
|
|
300
|
-
</Typography>
|
|
301
|
-
{description && (
|
|
302
|
-
<Typography component="div" variant="body2" className="arcblock-blocklet__describe" title={description}>
|
|
303
|
-
{description}
|
|
304
|
-
</Typography>
|
|
305
|
-
)}
|
|
306
|
-
{['md', 'sm', 'xs'].includes(actualSize) && (
|
|
307
|
-
<Portal container={container.current} disablePortal={actualSize === 'md'}>
|
|
308
|
-
<div
|
|
309
|
-
className="arcblock-blocklet__button"
|
|
310
|
-
onClick={_onButtonClick}
|
|
311
|
-
style={{ display: isStickyButton ? 'block' : '' }}>
|
|
312
|
-
{button ||
|
|
313
|
-
(onButtonClick && (
|
|
314
|
-
<Button
|
|
315
|
-
className="arcblock-blocklet__button--hover"
|
|
316
|
-
variant="outlined"
|
|
317
|
-
color="primary"
|
|
318
|
-
size="small"
|
|
319
|
-
disabled={buttonDisabled || buttonLoading}
|
|
320
|
-
style={
|
|
321
|
-
actualSize === 'md'
|
|
322
|
-
? { padding: '3px 20px', fontSize: '14px' }
|
|
323
|
-
: { padding: '3px 15px', minWidth: '54px', fontSize: '13px' }
|
|
324
|
-
}>
|
|
325
|
-
{buttonLoading && (
|
|
326
|
-
<CircularProgress
|
|
327
|
-
size={actualSize === 'md' ? 15 : 13}
|
|
328
|
-
style={{ marginRight: 3, color: 'inherit' }}
|
|
329
|
-
/>
|
|
330
|
-
)}
|
|
331
|
-
{buttonText}
|
|
332
|
-
</Button>
|
|
333
|
-
))}
|
|
334
|
-
</div>
|
|
335
|
-
</Portal>
|
|
336
|
-
)}
|
|
337
|
-
</div>
|
|
338
|
-
</div>
|
|
339
|
-
</div>
|
|
340
|
-
</div>
|
|
341
|
-
<div className="arcblock-blocklet__addons">
|
|
342
|
-
{addons.map((item, index) => (
|
|
343
|
-
<Typography
|
|
344
|
-
component="span"
|
|
345
|
-
variant="caption"
|
|
346
|
-
className="arcblock-blocklet__addons--item"
|
|
347
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
348
|
-
key={index}
|
|
349
|
-
title={item.title}>
|
|
350
|
-
{item.empty ? null : (
|
|
351
|
-
<>
|
|
352
|
-
<BlockletIcon name={item.icon} />
|
|
353
|
-
{item.pretty ? prettySize(item.value) : item.value}
|
|
354
|
-
</>
|
|
355
|
-
)}
|
|
356
|
-
</Typography>
|
|
357
|
-
))}
|
|
358
|
-
</div>
|
|
359
|
-
</Div>
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
BlockletNFT.propTypes = {
|
|
363
|
-
title: PropTypes.string.isRequired,
|
|
364
|
-
did: PropTypes.string,
|
|
365
|
-
isStickyButton: PropTypes.bool,
|
|
366
|
-
description: PropTypes.string,
|
|
367
|
-
cover: PropTypes.string,
|
|
368
|
-
buttonText: PropTypes.string,
|
|
369
|
-
buttonDisabled: PropTypes.bool,
|
|
370
|
-
buttonLoading: PropTypes.bool,
|
|
371
|
-
button: PropTypes.element,
|
|
372
|
-
addons: PropTypes.arrayOf(PropTypes.object),
|
|
373
|
-
size: PropTypes.oneOf(['xs', 'sm', 'md', 'auto']),
|
|
374
|
-
onButtonClick: PropTypes.func,
|
|
375
|
-
onMainClick: PropTypes.func,
|
|
376
|
-
className: PropTypes.string,
|
|
377
|
-
scaleClickZone: PropTypes.number,
|
|
378
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Box } from '@mui/material';
|
|
2
|
-
import { ThemeProvider } from '../Theme';
|
|
3
|
-
import { ThemeModeToggle } from '../Config';
|
|
4
|
-
import Basic from './demo/basic';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'ArcBlock/BlockletV2',
|
|
8
|
-
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
description: {
|
|
12
|
-
component: 'Blocklet component is used to display Blocklet Information version 2',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
design: {
|
|
16
|
-
type: 'figma',
|
|
17
|
-
url: 'https://www.figma.com/design/PwflHZjO9haj9tVYNhY6ft/Store?node-id=42-291&node-type=canvas&t=etFp6EEIoArJeDjp-0',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
decorators: [
|
|
21
|
-
(Story) => (
|
|
22
|
-
<ThemeProvider prefer="system">
|
|
23
|
-
<Box sx={{ py: 1 }}>
|
|
24
|
-
<ThemeModeToggle />
|
|
25
|
-
</Box>
|
|
26
|
-
<Story />
|
|
27
|
-
</ThemeProvider>
|
|
28
|
-
),
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
Basic.storyName = 'BlockletV2';
|
|
33
|
-
|
|
34
|
-
export { Basic };
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import React, { isValidElement } from 'react';
|
|
2
|
-
|
|
3
|
-
import Download from '@iconify-icons/tabler/cloud-download';
|
|
4
|
-
import { Icon } from '@iconify/react';
|
|
5
|
-
import { Verified as VerifiedIcon } from '@mui/icons-material';
|
|
6
|
-
import { Box, Card, CardProps, CircularProgress, Stack, SxProps, Typography } from '@mui/material';
|
|
7
|
-
import Avatar from '../Avatar';
|
|
8
|
-
import Button from '../Button';
|
|
9
|
-
import { useTheme } from '../Theme';
|
|
10
|
-
import IconText from './components/icon-text';
|
|
11
|
-
import TooltipIcon from './components/tooltip-icon';
|
|
12
|
-
import { formatDownloadCount, strippedString } from './utils';
|
|
13
|
-
|
|
14
|
-
export interface IBlockletStore extends CardProps {
|
|
15
|
-
did?: string;
|
|
16
|
-
title: string;
|
|
17
|
-
description?: string;
|
|
18
|
-
cover?: string;
|
|
19
|
-
avatar?: string;
|
|
20
|
-
author?: string;
|
|
21
|
-
download?: string;
|
|
22
|
-
official?: {
|
|
23
|
-
tooltip: React.ReactNode;
|
|
24
|
-
size?: number;
|
|
25
|
-
color?: string;
|
|
26
|
-
};
|
|
27
|
-
button?: React.ReactNode;
|
|
28
|
-
buttonText?: string;
|
|
29
|
-
buttonDisabled?: boolean;
|
|
30
|
-
buttonLoading?: boolean;
|
|
31
|
-
onButtonClick?: Function;
|
|
32
|
-
onMainClick?: Function;
|
|
33
|
-
className?: string;
|
|
34
|
-
status?: {
|
|
35
|
-
key: string;
|
|
36
|
-
icon: React.ReactNode;
|
|
37
|
-
text: React.ReactNode;
|
|
38
|
-
title?: React.ReactNode;
|
|
39
|
-
maxWidth?: number;
|
|
40
|
-
color?: string;
|
|
41
|
-
align?: 'left' | 'right';
|
|
42
|
-
}[];
|
|
43
|
-
icons?: {
|
|
44
|
-
key: string;
|
|
45
|
-
icon: string | React.ReactElement<any>;
|
|
46
|
-
title: React.ReactNode;
|
|
47
|
-
color?: string;
|
|
48
|
-
}[];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default function BlockletStore({ ...props }: IBlockletStore) {
|
|
52
|
-
const {
|
|
53
|
-
title,
|
|
54
|
-
description = '',
|
|
55
|
-
cover = '',
|
|
56
|
-
avatar,
|
|
57
|
-
author,
|
|
58
|
-
download,
|
|
59
|
-
did,
|
|
60
|
-
official,
|
|
61
|
-
buttonText = 'Install',
|
|
62
|
-
buttonDisabled,
|
|
63
|
-
buttonLoading,
|
|
64
|
-
button,
|
|
65
|
-
onButtonClick = () => {},
|
|
66
|
-
onMainClick,
|
|
67
|
-
className,
|
|
68
|
-
ref,
|
|
69
|
-
icons,
|
|
70
|
-
status,
|
|
71
|
-
...rest
|
|
72
|
-
} = props;
|
|
73
|
-
|
|
74
|
-
const theme = useTheme();
|
|
75
|
-
|
|
76
|
-
const wrapHandler =
|
|
77
|
-
(handler: Function, stopFn = () => false) =>
|
|
78
|
-
(e: React.MouseEvent<HTMLElement>, ...args: any[]) => {
|
|
79
|
-
const isFunction = handler instanceof Function;
|
|
80
|
-
if (stopFn() || isFunction) {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
e.stopPropagation();
|
|
83
|
-
if (isFunction) {
|
|
84
|
-
handler(...args);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const handleMainClick = onMainClick && wrapHandler(onMainClick);
|
|
90
|
-
const handleButtonClick = wrapHandler(onButtonClick, () => {
|
|
91
|
-
// stop click while custom button or buttonDisabled or buttonLoading
|
|
92
|
-
return !!(button || buttonDisabled || buttonLoading);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const titleProps: {
|
|
96
|
-
children?: React.ReactNode;
|
|
97
|
-
title?: string;
|
|
98
|
-
dangerouslySetInnerHTML?: { __html: string };
|
|
99
|
-
sx?: SxProps;
|
|
100
|
-
} = isValidElement(title)
|
|
101
|
-
? { children: title }
|
|
102
|
-
: { title: strippedString(title), dangerouslySetInnerHTML: { __html: title } };
|
|
103
|
-
|
|
104
|
-
const descriptionProps: {
|
|
105
|
-
children?: React.ReactNode;
|
|
106
|
-
title?: string;
|
|
107
|
-
dangerouslySetInnerHTML?: { __html: string };
|
|
108
|
-
sx?: SxProps;
|
|
109
|
-
} = isValidElement(description)
|
|
110
|
-
? { children: description }
|
|
111
|
-
: { title: strippedString(description), dangerouslySetInnerHTML: { __html: description } };
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<Card
|
|
115
|
-
variant="outlined"
|
|
116
|
-
onClick={handleMainClick}
|
|
117
|
-
{...rest}
|
|
118
|
-
sx={{ p: { xs: 2, md: 3 }, borderRadius: 1, ...rest.sx }}>
|
|
119
|
-
<Stack
|
|
120
|
-
direction="row"
|
|
121
|
-
sx={{
|
|
122
|
-
flex: 1,
|
|
123
|
-
gap: 1,
|
|
124
|
-
alignItems: 'center',
|
|
125
|
-
overflow: 'hidden',
|
|
126
|
-
'& > *': { flexShrink: 0 },
|
|
127
|
-
}}>
|
|
128
|
-
<Avatar src={cover} did={did} size={48} variant="rounded" style={{ borderRadius: '8px', overflow: 'hidden' }} />
|
|
129
|
-
<Typography
|
|
130
|
-
className="blocklet-title"
|
|
131
|
-
{...titleProps}
|
|
132
|
-
sx={[
|
|
133
|
-
{
|
|
134
|
-
fontWeight: 'fontWeightMedium',
|
|
135
|
-
fontSize: 16,
|
|
136
|
-
textOverflow: 'ellipsis',
|
|
137
|
-
whiteSpace: 'nowrap',
|
|
138
|
-
overflow: 'hidden',
|
|
139
|
-
cursor: 'default',
|
|
140
|
-
pl: 0.5,
|
|
141
|
-
'&&': { flexShrink: 1 },
|
|
142
|
-
},
|
|
143
|
-
...(Array.isArray(titleProps.sx) ? titleProps.sx : [titleProps.sx]),
|
|
144
|
-
]}
|
|
145
|
-
/>
|
|
146
|
-
<Box
|
|
147
|
-
sx={{
|
|
148
|
-
flex: 1,
|
|
149
|
-
display: 'flex',
|
|
150
|
-
alignItems: 'center',
|
|
151
|
-
justifyContent: 'flex-start',
|
|
152
|
-
gap: 1,
|
|
153
|
-
}}>
|
|
154
|
-
{official && (
|
|
155
|
-
<TooltipIcon title={official.tooltip}>
|
|
156
|
-
<VerifiedIcon sx={{ color: official.color || '#D97706', fontSize: official.size || 18 }} />
|
|
157
|
-
</TooltipIcon>
|
|
158
|
-
)}
|
|
159
|
-
{icons?.map((item) => (
|
|
160
|
-
<TooltipIcon key={item.key} title={item.title}>
|
|
161
|
-
{typeof item.icon === 'string' ? <Icon icon={item.icon} style={{ color: item.color }} /> : item.icon}
|
|
162
|
-
</TooltipIcon>
|
|
163
|
-
))}
|
|
164
|
-
</Box>
|
|
165
|
-
{onButtonClick && (
|
|
166
|
-
<Button
|
|
167
|
-
variant="outlined"
|
|
168
|
-
size="small"
|
|
169
|
-
disabled={buttonDisabled || buttonLoading}
|
|
170
|
-
style={{
|
|
171
|
-
color: theme.palette.text.primary,
|
|
172
|
-
borderColor: theme.palette.grey[300],
|
|
173
|
-
borderRadius: 8,
|
|
174
|
-
fontSize: 13,
|
|
175
|
-
fontWeight: theme.typography.fontWeightMedium,
|
|
176
|
-
}}
|
|
177
|
-
onClick={handleButtonClick}>
|
|
178
|
-
{buttonLoading && <CircularProgress size={15} style={{ marginRight: 3, color: 'inherit' }} />}
|
|
179
|
-
{buttonText}
|
|
180
|
-
</Button>
|
|
181
|
-
)}
|
|
182
|
-
{button}
|
|
183
|
-
</Stack>
|
|
184
|
-
<Stack
|
|
185
|
-
sx={{
|
|
186
|
-
py: 2,
|
|
187
|
-
}}>
|
|
188
|
-
<Typography
|
|
189
|
-
className="blocklet-description"
|
|
190
|
-
variant="body2"
|
|
191
|
-
{...descriptionProps}
|
|
192
|
-
sx={[
|
|
193
|
-
{
|
|
194
|
-
color: 'text.secondary',
|
|
195
|
-
display: '-webkit-box',
|
|
196
|
-
lineClamp: 2,
|
|
197
|
-
WebkitLineClamp: 2,
|
|
198
|
-
WebkitBoxOrient: 'vertical',
|
|
199
|
-
overflow: 'hidden',
|
|
200
|
-
cursor: 'default',
|
|
201
|
-
height: 40,
|
|
202
|
-
},
|
|
203
|
-
...(Array.isArray(descriptionProps.sx) ? descriptionProps.sx : [descriptionProps.sx]),
|
|
204
|
-
]}
|
|
205
|
-
/>
|
|
206
|
-
</Stack>
|
|
207
|
-
<Stack
|
|
208
|
-
direction="row"
|
|
209
|
-
sx={{
|
|
210
|
-
alignItems: 'center',
|
|
211
|
-
gap: 2,
|
|
212
|
-
color: 'text.secondary',
|
|
213
|
-
}}>
|
|
214
|
-
<IconText icon={<Avatar src={avatar} did={did} size={20} variant="circle" />} maxWidth={200}>
|
|
215
|
-
{author}
|
|
216
|
-
</IconText>
|
|
217
|
-
<IconText icon={<Icon icon={Download} />} title={download}>
|
|
218
|
-
{formatDownloadCount(download)}
|
|
219
|
-
</IconText>
|
|
220
|
-
{status
|
|
221
|
-
?.filter((item) => item.align !== 'right')
|
|
222
|
-
.map((item) => (
|
|
223
|
-
<IconText
|
|
224
|
-
key={item.key}
|
|
225
|
-
icon={typeof item.icon === 'string' ? <Icon icon={item.icon} /> : item.icon}
|
|
226
|
-
title={item.title}
|
|
227
|
-
maxWidth={item.maxWidth}>
|
|
228
|
-
{item.text}
|
|
229
|
-
</IconText>
|
|
230
|
-
))}
|
|
231
|
-
<Box sx={{ flex: 1 }} />
|
|
232
|
-
{status
|
|
233
|
-
?.filter((item) => item.align === 'right')
|
|
234
|
-
.map((item) => (
|
|
235
|
-
<IconText
|
|
236
|
-
key={item.key}
|
|
237
|
-
icon={typeof item.icon === 'string' ? <Icon icon={item.icon} /> : item.icon}
|
|
238
|
-
title={item.title}
|
|
239
|
-
maxWidth={item.maxWidth}
|
|
240
|
-
sx={{ color: item.color }}>
|
|
241
|
-
{item.text}
|
|
242
|
-
</IconText>
|
|
243
|
-
))}
|
|
244
|
-
</Stack>
|
|
245
|
-
</Card>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Stack, StackProps, Typography } from '@mui/material';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import TooltipIcon from './tooltip-icon';
|
|
4
|
-
|
|
5
|
-
export default function IconText({
|
|
6
|
-
icon = null,
|
|
7
|
-
children = null,
|
|
8
|
-
maxWidth = 100,
|
|
9
|
-
title = undefined,
|
|
10
|
-
sx = {},
|
|
11
|
-
}: {
|
|
12
|
-
icon?: React.ReactNode;
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
maxWidth?: number;
|
|
15
|
-
title?: React.ReactNode;
|
|
16
|
-
sx?: StackProps['sx'];
|
|
17
|
-
}) {
|
|
18
|
-
return (
|
|
19
|
-
(children === 0 || children) && (
|
|
20
|
-
<Stack
|
|
21
|
-
direction="row"
|
|
22
|
-
sx={[
|
|
23
|
-
{
|
|
24
|
-
alignItems: 'center',
|
|
25
|
-
gap: 0.5,
|
|
26
|
-
},
|
|
27
|
-
{ maxWidth, overflow: 'hidden' },
|
|
28
|
-
...(Array.isArray(sx) ? sx : [sx]),
|
|
29
|
-
]}>
|
|
30
|
-
{icon}
|
|
31
|
-
<TooltipIcon title={title || (typeof children === 'string' ? children : '')}>
|
|
32
|
-
<Typography
|
|
33
|
-
variant="body2"
|
|
34
|
-
sx={{
|
|
35
|
-
flex: 1,
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
textOverflow: 'ellipsis',
|
|
38
|
-
whiteSpace: 'nowrap',
|
|
39
|
-
cursor: 'default',
|
|
40
|
-
}}>
|
|
41
|
-
{children}
|
|
42
|
-
</Typography>
|
|
43
|
-
</TooltipIcon>
|
|
44
|
-
</Stack>
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
}
|