@arcblock/ux 2.1.18 → 2.1.21
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/ActionButton/index.js +16 -8
- package/lib/ActivityIndicator/index.js +49 -36
- package/lib/Alert/index.js +25 -17
- package/lib/AnimationWaiter/index.js +44 -35
- package/lib/Async/index.js +15 -3
- package/lib/Badge/index.js +14 -4
- package/lib/Blocklet/blocklet.js +81 -62
- package/lib/BlockletNFT/index.js +95 -76
- package/lib/Button/wrap.js +13 -9
- package/lib/Center/index.js +6 -5
- package/lib/ClickToCopy/index.js +31 -21
- package/lib/CodeBlock/index.js +35 -27
- package/lib/ContactForm/index.js +46 -41
- package/lib/CookieConsent/index.js +33 -21
- package/lib/CountDown/index.js +50 -34
- package/lib/Datatable/CustomToolbar.js +138 -97
- package/lib/Datatable/DatatableContext.js +9 -12
- package/lib/Datatable/TableSearch.js +44 -27
- package/lib/Datatable/index.js +44 -28
- package/lib/Dialog/confirm.js +26 -13
- package/lib/Dialog/dialog.js +42 -26
- package/lib/DriftBot/index.js +2 -2
- package/lib/Earth/index.js +121 -107
- package/lib/Empty/index.js +19 -10
- package/lib/ErrorBoundary/fallback.js +18 -12
- package/lib/Footer/index.js +32 -26
- package/lib/Header/header.js +37 -21
- package/lib/Header/responsive-header.js +40 -30
- package/lib/Icon/image.js +22 -15
- package/lib/Icon/index.js +17 -7
- package/lib/Img/index.js +34 -32
- package/lib/InfoRow/index.js +23 -13
- package/lib/Layout/dashboard/index.js +66 -54
- package/lib/Layout/dashboard/sidebar.js +39 -26
- package/lib/Layout/dashboard-legacy/header.js +56 -38
- package/lib/Layout/dashboard-legacy/index.js +54 -44
- package/lib/Layout/dashboard-legacy/sidebar.js +48 -38
- package/lib/Layout/index.js +147 -111
- package/lib/Locale/context.js +8 -10
- package/lib/Locale/selector.js +55 -41
- package/lib/Logo/index.js +50 -30
- package/lib/Metric/index.js +30 -23
- package/lib/NFTDisplay/aspect-ratio-container.js +15 -6
- package/lib/NFTDisplay/broken.js +3 -3
- package/lib/NFTDisplay/index.js +29 -28
- package/lib/NFTDisplay/loading.js +6 -5
- package/lib/NFTDisplay/svg-embedder/img.js +10 -4
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +14 -6
- package/lib/NavMenu/nav-menu.js +60 -49
- package/lib/PageScroller/index.js +29 -27
- package/lib/PageScroller/usePrevValue.js +1 -5
- package/lib/PricingTable/PricingPlan.js +46 -36
- package/lib/PricingTable/index.js +22 -20
- package/lib/QRCode/index.js +6 -9
- package/lib/RelativeTime/index.js +14 -5
- package/lib/Result/common.js +49 -44
- package/lib/Result/index.js +6 -6
- package/lib/Result/result.js +29 -18
- package/lib/Screenshot/index.js +32 -21
- package/lib/Spinner/index.js +3 -3
- package/lib/SplitButton/index.js +40 -24
- package/lib/Switch/index.js +12 -6
- package/lib/Tabs/index.js +18 -12
- package/lib/Tag/index.js +14 -4
- package/lib/Terminal/Player.js +108 -92
- package/lib/Terminal/index.js +3 -1
- package/lib/TextCollapse/index.js +18 -8
- package/lib/Toast/index.js +17 -14
- package/lib/Video/index.js +31 -25
- package/lib/Wallet/Action.js +37 -25
- package/lib/Wallet/Download.js +236 -181
- package/lib/Wallet/Open.js +6 -5
- package/lib/WechatPrompt/index.js +40 -28
- package/lib/withTheme/index.js +23 -9
- package/lib/withTracker/error_boundary.js +10 -7
- package/lib/withTracker/index.js +8 -4
- package/package.json +4 -4
- package/src/ActionButton/index.js +3 -4
- package/src/ActivityIndicator/index.js +4 -7
- package/src/Alert/index.js +4 -10
- package/src/AnimationWaiter/index.js +4 -2
- package/src/Async/index.js +4 -8
- package/src/Badge/index.js +2 -2
- package/src/Blocklet/blocklet.js +16 -27
- package/src/Blocklet/utils.js +3 -3
- package/src/BlockletNFT/index.js +7 -15
- package/src/Button/wrap.js +2 -2
- package/src/Center/index.js +0 -1
- package/src/ClickToCopy/index.js +5 -12
- package/src/CodeBlock/index.js +2 -7
- package/src/Colors/index.js +1 -0
- package/src/ContactForm/index.js +16 -16
- package/src/CookieConsent/index.js +3 -2
- package/src/CountDown/index.js +8 -8
- package/src/Datatable/CustomToolbar.js +8 -9
- package/src/Datatable/DatatableContext.js +3 -3
- package/src/Datatable/TableSearch.js +18 -13
- package/src/Datatable/index.js +13 -12
- package/src/Datatable/utils.js +19 -23
- package/src/Dialog/confirm.js +0 -1
- package/src/Dialog/dialog.js +7 -27
- package/src/Dialog/index.js +1 -0
- package/src/DriftBot/index.js +2 -2
- package/src/Earth/index.js +26 -44
- package/src/Empty/index.js +0 -1
- package/src/ErrorBoundary/fallback.js +2 -3
- package/src/Footer/index.js +3 -7
- package/src/Header/header.js +4 -5
- package/src/Header/responsive-header.js +4 -10
- package/src/Icon/image.js +0 -1
- package/src/Icon/index.js +8 -8
- package/src/Img/index.js +6 -6
- package/src/InfoRow/index.js +22 -21
- package/src/Layout/dashboard/index.js +9 -4
- package/src/Layout/dashboard/sidebar.js +4 -10
- package/src/Layout/dashboard-legacy/header.js +9 -15
- package/src/Layout/dashboard-legacy/index.js +4 -11
- package/src/Layout/dashboard-legacy/sidebar.js +7 -7
- package/src/Layout/index.js +12 -26
- package/src/Locale/browser-lang.js +2 -2
- package/src/Locale/context.js +7 -11
- package/src/Locale/selector.js +8 -8
- package/src/Logo/index.js +4 -6
- package/src/Metric/index.js +9 -10
- package/src/NFTDisplay/aspect-ratio-container.js +0 -1
- package/src/NFTDisplay/broken.js +0 -1
- package/src/NFTDisplay/index.js +10 -8
- package/src/NFTDisplay/loading.js +0 -1
- package/src/NFTDisplay/svg-embedder/img.js +1 -2
- package/src/NFTDisplay/svg-embedder/inline-svg.js +0 -1
- package/src/NavMenu/index.js +1 -0
- package/src/NavMenu/nav-menu.js +14 -27
- package/src/NavMenu/style.js +3 -3
- package/src/PageScroller/index.js +19 -35
- package/src/PageScroller/usePrevValue.js +1 -1
- package/src/PricingTable/PricingPlan.js +31 -30
- package/src/PricingTable/index.js +4 -5
- package/src/QRCode/index.js +3 -2
- package/src/RelativeTime/index.js +1 -5
- package/src/Result/common.js +19 -20
- package/src/Result/index.js +5 -6
- package/src/Result/result.js +2 -3
- package/src/Result/translations.js +1 -2
- package/src/Screenshot/index.js +10 -10
- package/src/Spinner/index.js +0 -1
- package/src/SplitButton/index.js +6 -19
- package/src/Switch/index.js +40 -41
- package/src/Tabs/index.js +2 -9
- package/src/Tag/index.js +2 -2
- package/src/Terminal/Player.js +7 -8
- package/src/Terminal/index.js +4 -3
- package/src/Terminal/util.js +3 -3
- package/src/TextCollapse/index.js +4 -10
- package/src/Theme/index.js +1 -8
- package/src/Toast/index.js +6 -10
- package/src/Util/index.js +15 -27
- package/src/Video/index.js +2 -8
- package/src/Wallet/Action.js +5 -6
- package/src/Wallet/Download.js +6 -7
- package/src/Wallet/Open.js +1 -2
- package/src/WechatPrompt/index.js +2 -7
- package/src/withTheme/index.js +5 -5
- package/src/withTracker/error_boundary.js +3 -3
- package/src/withTracker/index.js +2 -2
package/src/InfoRow/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import camelCase from 'lodash/camelCase';
|
|
4
3
|
import upperFirst from 'lodash/upperFirst';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
5
|
import Typography from '@mui/material/Typography';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{children && (
|
|
15
|
-
<Typography color="textPrimary" component={valueComponent} className="info-row__value">
|
|
16
|
-
{children}
|
|
7
|
+
function InfoRow({ name, nameFormatter, layout, children, valueComponent, nameWidth, ...rest }) {
|
|
8
|
+
return (
|
|
9
|
+
<Container layout={layout} width={nameWidth} {...rest}>
|
|
10
|
+
<Typography color="textSecondary" className="info-row__name">
|
|
11
|
+
{nameFormatter(name)}
|
|
17
12
|
</Typography>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
|
|
14
|
+
{children && (
|
|
15
|
+
<Typography color="textPrimary" component={valueComponent} className="info-row__value">
|
|
16
|
+
{children}
|
|
17
|
+
</Typography>
|
|
18
|
+
)}
|
|
19
|
+
</Container>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
21
22
|
|
|
22
23
|
InfoRow.propTypes = {
|
|
23
24
|
name: PropTypes.any.isRequired,
|
|
@@ -31,10 +32,10 @@ InfoRow.propTypes = {
|
|
|
31
32
|
InfoRow.defaultProps = {
|
|
32
33
|
children: null,
|
|
33
34
|
nameWidth: 90,
|
|
34
|
-
nameFormatter: name => {
|
|
35
|
+
nameFormatter: (name) => {
|
|
35
36
|
const resetName = name
|
|
36
37
|
.split(' ')
|
|
37
|
-
.map(x => upperFirst(camelCase(x)))
|
|
38
|
+
.map((x) => upperFirst(camelCase(x)))
|
|
38
39
|
.join(' ');
|
|
39
40
|
|
|
40
41
|
return typeof name === 'string' ? resetName : name;
|
|
@@ -45,15 +46,15 @@ InfoRow.defaultProps = {
|
|
|
45
46
|
|
|
46
47
|
const Container = styled.div`
|
|
47
48
|
display: flex;
|
|
48
|
-
flex-direction: ${props => (props.layout === 'vertical' ? 'column' : 'row')};
|
|
49
|
+
flex-direction: ${(props) => (props.layout === 'vertical' ? 'column' : 'row')};
|
|
49
50
|
justify-content: flex-start;
|
|
50
|
-
align-items: ${props => (props.layout === 'vertical' ? 'flex-start' : 'center')};
|
|
51
|
+
align-items: ${(props) => (props.layout === 'vertical' ? 'flex-start' : 'center')};
|
|
51
52
|
margin-bottom: 16px;
|
|
52
53
|
|
|
53
54
|
.info-row__name {
|
|
54
|
-
width: ${props => props.width}px;
|
|
55
|
-
margin-right: ${props => (props.layout === 'vertical' ? '0' : '8px')};
|
|
56
|
-
margin-bottom: ${props => (props.layout === 'vertical' ? '8px' : '0')};
|
|
55
|
+
width: ${(props) => props.width}px;
|
|
56
|
+
margin-right: ${(props) => (props.layout === 'vertical' ? '0' : '8px')};
|
|
57
|
+
margin-bottom: ${(props) => (props.layout === 'vertical' ? '8px' : '0')};
|
|
57
58
|
text-transform: capitalize;
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -64,7 +65,7 @@ const Container = styled.div`
|
|
|
64
65
|
font-weight: 500;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
@media (max-width: ${props => props.theme.breakpoints.values.md}px) {
|
|
68
|
+
@media (max-width: ${(props) => props.theme.breakpoints.values.md}px) {
|
|
68
69
|
flex-direction: column;
|
|
69
70
|
justify-content: flex-start;
|
|
70
71
|
align-items: flex-start;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { withRouter, Link, useLocation, matchPath } from 'react-router-dom';
|
|
4
4
|
import Helmet from 'react-helmet';
|
|
@@ -20,16 +20,17 @@ function NavMenuWrapper({ closeMenu, ...rest }) {
|
|
|
20
20
|
const location = useLocation();
|
|
21
21
|
useEffect(() => {
|
|
22
22
|
closeMenu();
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
23
24
|
}, [location]);
|
|
24
25
|
return <NavMenu {...rest} />;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
function Dashboard({ children, title, headerProps, links, ...rest }) {
|
|
28
|
+
function Dashboard({ children, title, headerProps, links, fullWidth, ...rest }) {
|
|
28
29
|
const theme = useTheme();
|
|
29
30
|
const location = useLocation();
|
|
30
31
|
const navItems = useMemo(
|
|
31
32
|
() =>
|
|
32
|
-
links.map(link => ({
|
|
33
|
+
links.map((link) => ({
|
|
33
34
|
...link,
|
|
34
35
|
label: <Link to={link.url}>{link.title}</Link>,
|
|
35
36
|
active: !!matchPath(location.pathname, { path: link.url, exact: false }),
|
|
@@ -65,7 +66,9 @@ function Dashboard({ children, title, headerProps, links, ...rest }) {
|
|
|
65
66
|
</Box>
|
|
66
67
|
</Hidden>
|
|
67
68
|
<Box className="dashboard-main">
|
|
68
|
-
<Container className="dashboard-content"
|
|
69
|
+
<Container className="dashboard-content" {...(fullWidth && { maxWidth: false })}>
|
|
70
|
+
{children}
|
|
71
|
+
</Container>
|
|
69
72
|
<Footer className="dashboard-footer" />
|
|
70
73
|
</Box>
|
|
71
74
|
</Box>
|
|
@@ -78,11 +81,13 @@ Dashboard.propTypes = {
|
|
|
78
81
|
title: PropTypes.string,
|
|
79
82
|
links: PropTypes.array.isRequired,
|
|
80
83
|
headerProps: PropTypes.object,
|
|
84
|
+
fullWidth: PropTypes.bool,
|
|
81
85
|
};
|
|
82
86
|
|
|
83
87
|
Dashboard.defaultProps = {
|
|
84
88
|
title: 'Home',
|
|
85
89
|
headerProps: {},
|
|
90
|
+
fullWidth: false,
|
|
86
91
|
};
|
|
87
92
|
|
|
88
93
|
const Wrapper = styled.div`
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
|
|
@@ -13,13 +12,8 @@ function Sidebar({ links, addons, ...rest }) {
|
|
|
13
12
|
{links.map(({ url, icon, title, showBadge }) => {
|
|
14
13
|
return (
|
|
15
14
|
<li key={url}>
|
|
16
|
-
<NavLink
|
|
17
|
-
|
|
18
|
-
className="layout-sidebar-link"
|
|
19
|
-
activeClassName="layout-sidebar-link--active">
|
|
20
|
-
<span className={`layout-sidebar-icon ${showBadge ? 'layout-sidebar-badge' : ''}`}>
|
|
21
|
-
{icon}
|
|
22
|
-
</span>
|
|
15
|
+
<NavLink to={url} className="layout-sidebar-link" activeClassName="layout-sidebar-link--active">
|
|
16
|
+
<span className={`layout-sidebar-icon ${showBadge ? 'layout-sidebar-badge' : ''}`}>{icon}</span>
|
|
23
17
|
<Typography component="span" className="layout-sidebar-link-text">
|
|
24
18
|
{title}
|
|
25
19
|
</Typography>
|
|
@@ -58,12 +52,12 @@ const Root = styled.div`
|
|
|
58
52
|
flex-direction: column;
|
|
59
53
|
align-items: center;
|
|
60
54
|
padding: 16px 0;
|
|
61
|
-
color: ${props => props.theme.palette.text.secondary};
|
|
55
|
+
color: ${(props) => props.theme.palette.text.secondary};
|
|
62
56
|
text-decoration: none;
|
|
63
57
|
|
|
64
58
|
&:hover,
|
|
65
59
|
&.layout-sidebar-link--active {
|
|
66
|
-
color: ${props => props.theme.palette.primary.main};
|
|
60
|
+
color: ${(props) => props.theme.palette.primary.main};
|
|
67
61
|
background: ${gradient};
|
|
68
62
|
border-left-color: ${teal.A700};
|
|
69
63
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import Button from '@mui/material/IconButton';
|
|
@@ -14,16 +13,16 @@ import Logo from '../../Logo';
|
|
|
14
13
|
|
|
15
14
|
const StyledAppBar = styled(AppBar)`
|
|
16
15
|
&& {
|
|
17
|
-
z-index: ${props => props.theme.zIndex.drawer};
|
|
18
|
-
background: ${props => props.theme.palette.background.default};
|
|
16
|
+
z-index: ${(props) => props.theme.zIndex.drawer};
|
|
17
|
+
background: ${(props) => props.theme.palette.background.default};
|
|
19
18
|
box-shadow: none;
|
|
20
19
|
top: 0;
|
|
21
20
|
height: auto;
|
|
22
21
|
}
|
|
23
22
|
.header-toolbar {
|
|
24
|
-
background: ${props => props.theme.palette.background.default};
|
|
25
|
-
color: ${props => props.theme.palette.text.primary};
|
|
26
|
-
margin: ${props => props.theme.spacing(1)}px 0;
|
|
23
|
+
background: ${(props) => props.theme.palette.background.default};
|
|
24
|
+
color: ${(props) => props.theme.palette.text.primary};
|
|
25
|
+
margin: ${(props) => props.theme.spacing(1)}px 0;
|
|
27
26
|
}
|
|
28
27
|
.header-link {
|
|
29
28
|
display: flex;
|
|
@@ -43,7 +42,7 @@ const StyledAppBar = styled(AppBar)`
|
|
|
43
42
|
.header-title__primary {
|
|
44
43
|
font-size: 24px;
|
|
45
44
|
font-weight: 800;
|
|
46
|
-
color: ${props => props.theme.typography.color.main};
|
|
45
|
+
color: ${(props) => props.theme.typography.color.main};
|
|
47
46
|
text-transform: uppercase;
|
|
48
47
|
display: flex;
|
|
49
48
|
align-items: center;
|
|
@@ -51,7 +50,7 @@ const StyledAppBar = styled(AppBar)`
|
|
|
51
50
|
.header-title__secondary {
|
|
52
51
|
font-size: 14px;
|
|
53
52
|
line-height: 1.71;
|
|
54
|
-
color: ${props => props.theme.typography.color.gray};
|
|
53
|
+
color: ${(props) => props.theme.typography.color.gray};
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
.header-addons {
|
|
@@ -71,7 +70,7 @@ const StyledAppBar = styled(AppBar)`
|
|
|
71
70
|
.header-menu {
|
|
72
71
|
display: none;
|
|
73
72
|
}
|
|
74
|
-
${props => props.theme.breakpoints.down('md')} {
|
|
73
|
+
${(props) => props.theme.breakpoints.down('md')} {
|
|
75
74
|
.header-title {
|
|
76
75
|
display: none;
|
|
77
76
|
}
|
|
@@ -107,12 +106,7 @@ export default function Header({
|
|
|
107
106
|
return (
|
|
108
107
|
<StyledAppBar position="sticky" className="header" {...rest}>
|
|
109
108
|
<Toolbar disableGutters={false} className="header-toolbar">
|
|
110
|
-
<Button
|
|
111
|
-
color="inherit"
|
|
112
|
-
aria-label="open drawer"
|
|
113
|
-
edge="start"
|
|
114
|
-
className="header-menu"
|
|
115
|
-
onClick={onToggleMenu}>
|
|
109
|
+
<Button color="inherit" aria-label="open drawer" edge="start" className="header-menu" onClick={onToggleMenu}>
|
|
116
110
|
<MenuIcon />
|
|
117
111
|
</Button>
|
|
118
112
|
<Link to={homeUrl} className="header-link">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Helmet from 'react-helmet';
|
|
4
4
|
import styled from 'styled-components';
|
|
@@ -38,9 +38,8 @@ const Wrapper = styled.div`
|
|
|
38
38
|
position: relative;
|
|
39
39
|
white-space: nowrap;
|
|
40
40
|
width: 120px;
|
|
41
|
-
background: ${props => props.theme.palette.background.default};
|
|
42
|
-
box-shadow: 2px 16px 10px 0
|
|
43
|
-
rgba(0, 0, 0, ${props => (props.theme.mode === 'light' ? 0.05 : 0.5)});
|
|
41
|
+
background: ${(props) => props.theme.palette.background.default};
|
|
42
|
+
box-shadow: 2px 16px 10px 0 rgba(0, 0, 0, ${(props) => (props.theme.mode === 'light' ? 0.05 : 0.5)});
|
|
44
43
|
border: 0;
|
|
45
44
|
}
|
|
46
45
|
`;
|
|
@@ -100,13 +99,7 @@ export default function Dashboard({
|
|
|
100
99
|
open={drawerOpen}
|
|
101
100
|
onClose={onToggleDrawer}
|
|
102
101
|
ModalProps={{ disablePortal: true, keepMounted: true }}>
|
|
103
|
-
<Sidebar
|
|
104
|
-
className="dashboard__sidebar"
|
|
105
|
-
images={images}
|
|
106
|
-
links={links}
|
|
107
|
-
prefix={prefix}
|
|
108
|
-
logo={logo}
|
|
109
|
-
/>
|
|
102
|
+
<Sidebar className="dashboard__sidebar" images={images} links={links} prefix={prefix} logo={logo} />
|
|
110
103
|
</Drawer>
|
|
111
104
|
<Box className="dashboard__main">
|
|
112
105
|
<Container maxWidth={isFullWidth ? false : 'lg'} className="dashboard__content">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { memo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import withTheme from '@mui/styles/withTheme';
|
|
@@ -61,7 +61,7 @@ Sidebar.defaultProps = {
|
|
|
61
61
|
logo: null,
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
const MenuItems =
|
|
64
|
+
const MenuItems = memo(styled.div`
|
|
65
65
|
flex: 1;
|
|
66
66
|
display: flex;
|
|
67
67
|
flex-direction: column;
|
|
@@ -69,7 +69,7 @@ const MenuItems = React.memo(styled.div`
|
|
|
69
69
|
&& .sidebar-logo {
|
|
70
70
|
display: none;
|
|
71
71
|
border-bottom: 1px solid #eee;
|
|
72
|
-
background: ${props => props.theme.palette.background.default};
|
|
72
|
+
background: ${(props) => props.theme.palette.background.default};
|
|
73
73
|
position: sticky;
|
|
74
74
|
top: 0;
|
|
75
75
|
z-index: 1;
|
|
@@ -77,7 +77,7 @@ const MenuItems = React.memo(styled.div`
|
|
|
77
77
|
text-align: center;
|
|
78
78
|
font-size: 0;
|
|
79
79
|
}
|
|
80
|
-
${props => props.theme.breakpoints.down('md')} {
|
|
80
|
+
${(props) => props.theme.breakpoints.down('md')} {
|
|
81
81
|
&& .sidebar-logo {
|
|
82
82
|
display: block;
|
|
83
83
|
}
|
|
@@ -94,9 +94,9 @@ const MenuItem = styled(Button)`
|
|
|
94
94
|
align-items: center;
|
|
95
95
|
width: 100%;
|
|
96
96
|
transition: all 200ms ease-in-out;
|
|
97
|
-
background: ${props => (props.selected ? gradient : '')};
|
|
97
|
+
background: ${(props) => (props.selected ? gradient : '')};
|
|
98
98
|
padding: 24px 0;
|
|
99
|
-
border-left: 2px solid ${props => (props.selected ? teal.A700 : 'transparent')};
|
|
99
|
+
border-left: 2px solid ${(props) => (props.selected ? teal.A700 : 'transparent')};
|
|
100
100
|
border-radius: 0;
|
|
101
101
|
|
|
102
102
|
&:hover {
|
|
@@ -112,7 +112,7 @@ const MenuItem = styled(Button)`
|
|
|
112
112
|
text-transform: capitalize;
|
|
113
113
|
letter-spacing: normal;
|
|
114
114
|
width: 80%;
|
|
115
|
-
color: ${props => props.theme.palette.text.primary};
|
|
115
|
+
color: ${(props) => props.theme.palette.text.primary};
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
`;
|
package/src/Layout/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import Helmet from 'react-helmet';
|
|
@@ -37,7 +37,7 @@ export default function Layout({
|
|
|
37
37
|
contentOnly,
|
|
38
38
|
...rest
|
|
39
39
|
}) {
|
|
40
|
-
const [drawerOpen, setDrawerOpen] =
|
|
40
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
41
41
|
const onToggleDrawer = () => {
|
|
42
42
|
setDrawerOpen(!drawerOpen);
|
|
43
43
|
};
|
|
@@ -48,7 +48,7 @@ export default function Layout({
|
|
|
48
48
|
|
|
49
49
|
let activeLink = '';
|
|
50
50
|
const { pathname: currentPath } = new URL(window.location);
|
|
51
|
-
links.forEach(link => {
|
|
51
|
+
links.forEach((link) => {
|
|
52
52
|
if (currentPath.startsWith(link.url) && link.url.length > activeLink.length) {
|
|
53
53
|
activeLink = link.url;
|
|
54
54
|
}
|
|
@@ -57,22 +57,17 @@ export default function Layout({
|
|
|
57
57
|
const drawer = (
|
|
58
58
|
<div>
|
|
59
59
|
<Toolbar className="toolbar toolbar--drawer">
|
|
60
|
-
{showLogo
|
|
60
|
+
{!!showLogo && <div className="menu-logo">{logo}</div>}
|
|
61
61
|
<div style={{ flexGrow: 1, overflow: 'hidden', textOverflow: 'ellipsis' }}>{brand}</div>
|
|
62
62
|
</Toolbar>
|
|
63
63
|
<Divider />
|
|
64
64
|
<List>
|
|
65
|
-
{links.map(x => (
|
|
65
|
+
{links.map((x) => (
|
|
66
66
|
<Link className="nav-link" key={x.url} href={x.url} underline="hover">
|
|
67
67
|
<ListItem button className={activeLink === x.url ? 'drawer-highlight-nav' : ''}>
|
|
68
68
|
<ListItemText>
|
|
69
69
|
{x.icon && (
|
|
70
|
-
<Icon
|
|
71
|
-
name={x.icon}
|
|
72
|
-
size={18 * (x.iconZoom || 1)}
|
|
73
|
-
color="inherit"
|
|
74
|
-
style={{ marginRight: '5px' }}
|
|
75
|
-
/>
|
|
70
|
+
<Icon name={x.icon} size={18 * (x.iconZoom || 1)} color="inherit" style={{ marginRight: '5px' }} />
|
|
76
71
|
)}
|
|
77
72
|
{x.title}
|
|
78
73
|
</ListItemText>
|
|
@@ -87,11 +82,7 @@ export default function Layout({
|
|
|
87
82
|
<>
|
|
88
83
|
<Div {...rest}>
|
|
89
84
|
<Helmet title={title} />
|
|
90
|
-
<AppBar
|
|
91
|
-
position="fixed"
|
|
92
|
-
className={`appbar appbar--${variant}`}
|
|
93
|
-
color="default"
|
|
94
|
-
style={{ height: 56 }}>
|
|
85
|
+
<AppBar position="fixed" className={`appbar appbar--${variant}`} color="default" style={{ height: 56 }}>
|
|
95
86
|
<Container disableGutters>
|
|
96
87
|
<Toolbar className="toolbar">
|
|
97
88
|
<IconButton
|
|
@@ -103,7 +94,7 @@ export default function Layout({
|
|
|
103
94
|
size="large">
|
|
104
95
|
<MenuIcon />
|
|
105
96
|
</IconButton>
|
|
106
|
-
{showLogo
|
|
97
|
+
{!!showLogo && <div className="menu-logo">{logo}</div>}
|
|
107
98
|
<Typography
|
|
108
99
|
href={homeUrl}
|
|
109
100
|
component="a"
|
|
@@ -115,18 +106,13 @@ export default function Layout({
|
|
|
115
106
|
{brand}
|
|
116
107
|
</Typography>
|
|
117
108
|
{description && (
|
|
118
|
-
<Typography
|
|
119
|
-
component="small"
|
|
120
|
-
variant="subtitle2"
|
|
121
|
-
color="inherit"
|
|
122
|
-
noWrap
|
|
123
|
-
className="description">
|
|
109
|
+
<Typography component="small" variant="subtitle2" color="inherit" noWrap className="description">
|
|
124
110
|
{description}
|
|
125
111
|
</Typography>
|
|
126
112
|
)}
|
|
127
113
|
<div style={{ flexGrow: 1 }} />
|
|
128
114
|
<div className="nav-links">
|
|
129
|
-
{links.map(x => (
|
|
115
|
+
{links.map((x) => (
|
|
130
116
|
<Link
|
|
131
117
|
key={x.url}
|
|
132
118
|
href={x.url}
|
|
@@ -266,7 +252,7 @@ const Div = styled.div`
|
|
|
266
252
|
}
|
|
267
253
|
}
|
|
268
254
|
|
|
269
|
-
${props => props.theme.breakpoints.up('md')} {
|
|
255
|
+
${(props) => props.theme.breakpoints.up('md')} {
|
|
270
256
|
.toolbar {
|
|
271
257
|
.menu-button {
|
|
272
258
|
display: none;
|
|
@@ -280,7 +266,7 @@ const Div = styled.div`
|
|
|
280
266
|
}
|
|
281
267
|
}
|
|
282
268
|
|
|
283
|
-
${props => props.theme.breakpoints.down('md')} {
|
|
269
|
+
${(props) => props.theme.breakpoints.down('md')} {
|
|
284
270
|
.toolbar {
|
|
285
271
|
.nav-links,
|
|
286
272
|
.menu-logo,
|
|
@@ -49,14 +49,14 @@ function getPreferredLanguage(options) {
|
|
|
49
49
|
return fallback;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const match = languages.filter(lang => normalizeCode(lang) === browserLanguage);
|
|
52
|
+
const match = languages.filter((lang) => normalizeCode(lang) === browserLanguage);
|
|
53
53
|
|
|
54
54
|
if (match.length > 0) {
|
|
55
55
|
return match[0] || fallback;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// en == en_US
|
|
59
|
-
const matchCodeOnly = languages.filter(lang => startsWith(browserLanguage, lang));
|
|
59
|
+
const matchCodeOnly = languages.filter((lang) => startsWith(browserLanguage, lang));
|
|
60
60
|
return matchCodeOnly[0] || fallback;
|
|
61
61
|
}
|
|
62
62
|
|
package/src/Locale/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-prototype-builtins */
|
|
2
|
-
import
|
|
2
|
+
import { createContext, useState, useEffect, useContext } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Cookie from 'js-cookie';
|
|
5
5
|
|
|
@@ -19,21 +19,21 @@ const langParams = {
|
|
|
19
19
|
// 跨应用传递多语言选择的方式是在 query string 中添加 locale 参数,LocaleSelector 要高优先级遵守这个参数
|
|
20
20
|
const getLocaleFromSearchParams = (url = window.location.href) => {
|
|
21
21
|
const locale = new URL(url).searchParams.get('locale');
|
|
22
|
-
if (languages.find(x => x.value === locale)) {
|
|
22
|
+
if (languages.find((x) => x.value === locale)) {
|
|
23
23
|
return locale;
|
|
24
24
|
}
|
|
25
25
|
return null;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const getLocale = locale =>
|
|
28
|
+
const getLocale = (locale) =>
|
|
29
29
|
locale || getLocaleFromSearchParams() || Cookie.get(cookieName) || browserLang(langParams);
|
|
30
|
-
const setLocale = locale => Cookie.set(cookieName, locale, getCookieOptions());
|
|
30
|
+
const setLocale = (locale) => Cookie.set(cookieName, locale, getCookieOptions());
|
|
31
31
|
|
|
32
32
|
const replace = (template, data) =>
|
|
33
33
|
template.replace(/{(\w*)}/g, (m, key) => (data.hasOwnProperty(key) ? data[key] : ''));
|
|
34
34
|
|
|
35
35
|
const create = () => {
|
|
36
|
-
const LocaleContext =
|
|
36
|
+
const LocaleContext = createContext();
|
|
37
37
|
const { Provider, Consumer } = LocaleContext;
|
|
38
38
|
function LocaleProvider({ children, locale, translations, ...rest }) {
|
|
39
39
|
const [currentLocale, setCurrentLocale] = useState(getLocale(locale));
|
|
@@ -42,7 +42,7 @@ const create = () => {
|
|
|
42
42
|
setLocale(currentLocale);
|
|
43
43
|
}, [currentLocale]);
|
|
44
44
|
|
|
45
|
-
const changeLocale = newLocale => {
|
|
45
|
+
const changeLocale = (newLocale) => {
|
|
46
46
|
setCurrentLocale(newLocale);
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -55,11 +55,7 @@ const create = () => {
|
|
|
55
55
|
return replace(translations[currentLocale][key], data);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
return
|
|
59
|
-
<Provider value={{ locale: currentLocale, changeLocale, t: translate, ...rest }}>
|
|
60
|
-
{children}
|
|
61
|
-
</Provider>
|
|
62
|
-
);
|
|
58
|
+
return <Provider value={{ locale: currentLocale, changeLocale, t: translate, ...rest }}>{children}</Provider>;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
61
|
function useLocaleContext() {
|
package/src/Locale/selector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-no-bind */
|
|
2
|
-
import
|
|
2
|
+
import { useState, useContext, useRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ function LocaleSelector(props) {
|
|
|
28
28
|
const [open, setOpen] = useState(false);
|
|
29
29
|
const theme = useTheme();
|
|
30
30
|
|
|
31
|
-
const onSelect = newLocale => {
|
|
31
|
+
const onSelect = (newLocale) => {
|
|
32
32
|
changeLocale(newLocale);
|
|
33
33
|
setOpen(false);
|
|
34
34
|
if (typeof props.onChange === 'function') {
|
|
@@ -50,7 +50,7 @@ function LocaleSelector(props) {
|
|
|
50
50
|
<img src={dark ? globeDark : globeLight} className="trigger-image" alt="globe" />
|
|
51
51
|
{showText ? (
|
|
52
52
|
<Typography component="strong" className="trigger-text">
|
|
53
|
-
{languages.find(x => x.value === locale).text}
|
|
53
|
+
{languages.find((x) => x.value === locale).text}
|
|
54
54
|
</Typography>
|
|
55
55
|
) : (
|
|
56
56
|
''
|
|
@@ -103,18 +103,18 @@ const Div = styled.div`
|
|
|
103
103
|
justify-content: center;
|
|
104
104
|
font-size: 14px;
|
|
105
105
|
.trigger-image {
|
|
106
|
-
width: ${props => props.size}px;
|
|
107
|
-
height: ${props => props.size}px;
|
|
106
|
+
width: ${(props) => props.size}px;
|
|
107
|
+
height: ${(props) => props.size}px;
|
|
108
108
|
}
|
|
109
109
|
.trigger-text {
|
|
110
110
|
margin-left: 5px;
|
|
111
111
|
font-size: 14px;
|
|
112
|
-
color: ${props => getColor(props)};
|
|
112
|
+
color: ${(props) => getColor(props)};
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
.locales {
|
|
117
|
-
background: ${props => getBackground(props)};
|
|
117
|
+
background: ${(props) => getBackground(props)};
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
.locale-item {
|
|
@@ -124,7 +124,7 @@ const Div = styled.div`
|
|
|
124
124
|
line-height: normal;
|
|
125
125
|
letter-spacing: 2px;
|
|
126
126
|
text-align: center;
|
|
127
|
-
color: ${props => getColor(props)};
|
|
127
|
+
color: ${(props) => getColor(props)};
|
|
128
128
|
cursor: pointer;
|
|
129
129
|
display: flex;
|
|
130
130
|
padding: 16px;
|
package/src/Logo/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
|
|
@@ -9,8 +8,7 @@ import { ReactComponent as DarkText } from './images/logo-dark-text.svg';
|
|
|
9
8
|
|
|
10
9
|
export default function Logo({ showText, showLogo, mode, layout, ...rest }) {
|
|
11
10
|
const logo = mode === 'light' ? <LightLogo /> : <DarkLogo />;
|
|
12
|
-
const text =
|
|
13
|
-
mode === 'light' ? <LightText className="logo-text" /> : <DarkText className="logo-text" />;
|
|
11
|
+
const text = mode === 'light' ? <LightText className="logo-text" /> : <DarkText className="logo-text" />;
|
|
14
12
|
|
|
15
13
|
return (
|
|
16
14
|
<Container layout={layout} {...rest}>
|
|
@@ -36,12 +34,12 @@ Logo.defaultProps = {
|
|
|
36
34
|
|
|
37
35
|
const Container = styled.span`
|
|
38
36
|
display: inline-flex;
|
|
39
|
-
flex-direction: ${props => (props.layout === 'horizontal' ? 'row' : 'column')};
|
|
37
|
+
flex-direction: ${(props) => (props.layout === 'horizontal' ? 'row' : 'column')};
|
|
40
38
|
justify-content: center;
|
|
41
39
|
align-items: center;
|
|
42
40
|
|
|
43
41
|
.logo-text {
|
|
44
|
-
${props => (props.layout === 'vertical' ? 'margin-top: 8px;' : '')}
|
|
45
|
-
${props => (props.layout === 'vertical' ? '' : 'margin-left: 8px;')};
|
|
42
|
+
${(props) => (props.layout === 'vertical' ? 'margin-top: 8px;' : '')}
|
|
43
|
+
${(props) => (props.layout === 'vertical' ? '' : 'margin-left: 8px;')};
|
|
46
44
|
}
|
|
47
45
|
`;
|
package/src/Metric/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable react/no-danger */
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
4
|
|
|
@@ -42,9 +41,9 @@ Metric.defaultProps = {
|
|
|
42
41
|
};
|
|
43
42
|
|
|
44
43
|
const Container = styled.div`
|
|
45
|
-
border-left: 1px solid ${props => props.theme.typography.color.main};
|
|
44
|
+
border-left: 1px solid ${(props) => props.theme.typography.color.main};
|
|
46
45
|
padding: 10px 0 10px 16px;
|
|
47
|
-
@media (max-width: ${props => props.theme.breakpoints.values.sm}px) {
|
|
46
|
+
@media (max-width: ${(props) => props.theme.breakpoints.values.sm}px) {
|
|
48
47
|
padding: 0 0 0 8px;
|
|
49
48
|
}
|
|
50
49
|
|
|
@@ -64,19 +63,19 @@ const Container = styled.div`
|
|
|
64
63
|
|
|
65
64
|
.metric__number {
|
|
66
65
|
margin-bottom: 8px;
|
|
67
|
-
font-size: ${props => (props.size === 'small' ? 32 : 36)}px;
|
|
66
|
+
font-size: ${(props) => (props.size === 'small' ? 32 : 36)}px;
|
|
68
67
|
font-weight: 600;
|
|
69
68
|
line-height: 36px;
|
|
70
|
-
color: ${props => props.theme.typography.color.main};
|
|
69
|
+
color: ${(props) => props.theme.typography.color.main};
|
|
71
70
|
|
|
72
71
|
small {
|
|
73
72
|
font-size: 12px;
|
|
74
73
|
line-height: 12px;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
@media (max-width: ${props => props.theme.breakpoints.values.sm}px) {
|
|
78
|
-
font-size: ${props => (props.size === 'small' ? 24 : 28)}px;
|
|
79
|
-
line-height: ${props => (props.size === 'small' ? 24 : 28)}px;
|
|
76
|
+
@media (max-width: ${(props) => props.theme.breakpoints.values.sm}px) {
|
|
77
|
+
font-size: ${(props) => (props.size === 'small' ? 24 : 28)}px;
|
|
78
|
+
line-height: ${(props) => (props.size === 'small' ? 24 : 28)}px;
|
|
80
79
|
margin-bottom: 2px;
|
|
81
80
|
}
|
|
82
81
|
}
|
|
@@ -94,8 +93,8 @@ const Container = styled.div`
|
|
|
94
93
|
text-transform: capitalize;
|
|
95
94
|
line-height: 1.2;
|
|
96
95
|
font-weight: 500;
|
|
97
|
-
color: ${props => props.theme.typography.color.main};
|
|
98
|
-
@media (max-width: ${props => props.theme.breakpoints.values.sm}px) {
|
|
96
|
+
color: ${(props) => props.theme.typography.color.main};
|
|
97
|
+
@media (max-width: ${(props) => props.theme.breakpoints.values.sm}px) {
|
|
99
98
|
font-size: 10px;
|
|
100
99
|
line-height: 1;
|
|
101
100
|
}
|
package/src/NFTDisplay/broken.js
CHANGED