@blocklet/ui-react 2.9.91 → 2.10.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/build.config.ts +1 -6
- package/lib/@types/index.d.ts +1 -0
- package/lib/@types/index.js +0 -1
- package/lib/BlockletStudio/index.js +50 -50
- package/lib/ComponentInstaller/index.js +122 -202
- package/lib/ComponentInstaller/installer-item.js +116 -138
- package/lib/ComponentInstaller/locales.js +5 -10
- package/lib/ComponentInstaller/use-component-installed.js +37 -41
- package/lib/ComponentManager/components/add-component.js +58 -67
- package/lib/ComponentManager/components/check-component.js +2 -9
- package/lib/ComponentManager/components/publish-component.js +50 -59
- package/lib/ComponentManager/components/resource-dialog.js +42 -39
- package/lib/ComponentManager/index.js +3 -27
- package/lib/ComponentManager/libs/locales.js +2 -8
- package/lib/Dashboard/index.js +74 -99
- package/lib/Footer/brand.js +21 -43
- package/lib/Footer/copyright.js +15 -24
- package/lib/Footer/index.js +47 -71
- package/lib/Footer/internal-footer.js +72 -100
- package/lib/Footer/layout/plain.js +26 -45
- package/lib/Footer/layout/row.js +12 -29
- package/lib/Footer/layout/standard.js +34 -64
- package/lib/Footer/links.js +74 -104
- package/lib/Footer/social-media.js +35 -42
- package/lib/Header/index.js +69 -117
- package/lib/Icon/index.js +18 -53
- package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
- package/lib/UserCenter/components/config-profile.js +67 -0
- package/lib/UserCenter/components/notification.js +203 -186
- package/lib/UserCenter/components/passport.js +70 -79
- package/lib/UserCenter/components/privacy.js +86 -88
- package/lib/UserCenter/components/settings.js +74 -84
- package/lib/UserCenter/components/storage/connect-to.js +56 -75
- package/lib/UserCenter/components/storage/connected.js +16 -37
- package/lib/UserCenter/components/storage/delete.js +42 -51
- package/lib/UserCenter/components/storage/disconnect.js +15 -29
- package/lib/UserCenter/components/storage/index.js +20 -54
- package/lib/UserCenter/components/storage/item.js +94 -122
- package/lib/UserCenter/components/storage/preview-nft.js +77 -85
- package/lib/UserCenter/components/third-party-login/index.js +49 -61
- package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
- package/lib/UserCenter/components/user-center.js +276 -287
- package/lib/UserCenter/components/user-info/index.js +3 -27
- package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
- package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
- package/lib/UserCenter/components/user-info/user-info.js +41 -74
- package/lib/UserCenter/components/webhook-item.js +184 -177
- package/lib/UserCenter/index.js +1 -13
- package/lib/UserCenter/libs/api.js +4 -16
- package/lib/UserCenter/libs/locales.d.ts +10 -0
- package/lib/UserCenter/libs/locales.js +12 -8
- package/lib/UserCenter/libs/utils.js +7 -17
- package/lib/UserSessions/components/user-session-info.js +88 -85
- package/lib/UserSessions/components/user-sessions.js +177 -213
- package/lib/UserSessions/index.js +1 -13
- package/lib/UserSessions/libs/locales.js +2 -8
- package/lib/UserSessions/libs/utils.js +4 -11
- package/lib/blocklets.js +59 -63
- package/lib/common/header-addons.js +44 -60
- package/lib/common/link-blocker.js +9 -18
- package/lib/common/overridable-theme-provider.js +10 -23
- package/lib/common/wallet-hidden-topbar.js +7 -14
- package/lib/contexts/config-user-space.js +38 -46
- package/lib/hooks/use-mobile.js +5 -13
- package/lib/index.js +10 -100
- package/lib/libs/client.js +2 -8
- package/lib/libs/spaces.js +6 -13
- package/lib/types.js +39 -41
- package/lib/utils.js +25 -44
- package/package.json +8 -38
- package/src/@types/index.ts +1 -0
- package/src/Footer/brand.jsx +6 -1
- package/src/UserCenter/components/config-profile.tsx +70 -0
- package/src/UserCenter/components/notification.tsx +63 -47
- package/src/UserCenter/components/settings.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +10 -0
- package/es/@types/index.d.ts +0 -101
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +0 -16
- package/es/BlockletStudio/index.d.ts +0 -28
- package/es/BlockletStudio/index.js +0 -114
- package/es/ComponentInstaller/index.d.ts +0 -37
- package/es/ComponentInstaller/index.js +0 -200
- package/es/ComponentInstaller/installer-item.d.ts +0 -21
- package/es/ComponentInstaller/installer-item.js +0 -139
- package/es/ComponentInstaller/locales.d.ts +0 -28
- package/es/ComponentInstaller/locales.js +0 -22
- package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
- package/es/ComponentInstaller/use-component-installed.js +0 -88
- package/es/ComponentManager/components/add-component.d.ts +0 -16
- package/es/ComponentManager/components/add-component.js +0 -114
- package/es/ComponentManager/components/check-component.d.ts +0 -2
- package/es/ComponentManager/components/check-component.js +0 -2
- package/es/ComponentManager/components/publish-component.d.ts +0 -10
- package/es/ComponentManager/components/publish-component.js +0 -76
- package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
- package/es/ComponentManager/components/resource-dialog.js +0 -74
- package/es/ComponentManager/index.d.ts +0 -3
- package/es/ComponentManager/index.js +0 -3
- package/es/ComponentManager/libs/locales.d.ts +0 -14
- package/es/ComponentManager/libs/locales.js +0 -14
- package/es/Dashboard/index.d.ts +0 -40
- package/es/Dashboard/index.js +0 -118
- package/es/Footer/brand.d.ts +0 -22
- package/es/Footer/brand.js +0 -73
- package/es/Footer/copyright.d.ts +0 -18
- package/es/Footer/copyright.js +0 -25
- package/es/Footer/index.d.ts +0 -6
- package/es/Footer/index.js +0 -82
- package/es/Footer/internal-footer.d.ts +0 -29
- package/es/Footer/internal-footer.js +0 -117
- package/es/Footer/layout/plain.d.ts +0 -15
- package/es/Footer/layout/plain.js +0 -39
- package/es/Footer/layout/row.d.ts +0 -18
- package/es/Footer/layout/row.js +0 -41
- package/es/Footer/layout/standard.d.ts +0 -15
- package/es/Footer/layout/standard.js +0 -53
- package/es/Footer/links.d.ts +0 -22
- package/es/Footer/links.js +0 -207
- package/es/Footer/social-media.d.ts +0 -14
- package/es/Footer/social-media.js +0 -60
- package/es/Header/index.d.ts +0 -10
- package/es/Header/index.js +0 -155
- package/es/Icon/index.d.ts +0 -23
- package/es/Icon/index.js +0 -55
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.js +0 -248
- package/es/UserCenter/components/passport.d.ts +0 -6
- package/es/UserCenter/components/passport.js +0 -88
- package/es/UserCenter/components/privacy.d.ts +0 -11
- package/es/UserCenter/components/privacy.js +0 -99
- package/es/UserCenter/components/settings.d.ts +0 -9
- package/es/UserCenter/components/settings.js +0 -89
- package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
- package/es/UserCenter/components/storage/connect-to.js +0 -108
- package/es/UserCenter/components/storage/connected.d.ts +0 -7
- package/es/UserCenter/components/storage/connected.js +0 -24
- package/es/UserCenter/components/storage/delete.d.ts +0 -7
- package/es/UserCenter/components/storage/delete.js +0 -62
- package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
- package/es/UserCenter/components/storage/disconnect.js +0 -23
- package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
- package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/es/UserCenter/components/storage/index.d.ts +0 -3
- package/es/UserCenter/components/storage/index.js +0 -27
- package/es/UserCenter/components/storage/item.d.ts +0 -9
- package/es/UserCenter/components/storage/item.js +0 -158
- package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
- package/es/UserCenter/components/storage/preview-nft.js +0 -80
- package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
- package/es/UserCenter/components/third-party-login/index.js +0 -110
- package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
- package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
- package/es/UserCenter/components/user-center.d.ts +0 -15
- package/es/UserCenter/components/user-center.js +0 -414
- package/es/UserCenter/components/user-info/index.d.ts +0 -3
- package/es/UserCenter/components/user-info/index.js +0 -3
- package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
- package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-info-item.js +0 -47
- package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
- package/es/UserCenter/components/user-info/user-info.js +0 -66
- package/es/UserCenter/components/webhook-item.d.ts +0 -3
- package/es/UserCenter/components/webhook-item.js +0 -243
- package/es/UserCenter/index.d.ts +0 -1
- package/es/UserCenter/index.js +0 -1
- package/es/UserCenter/libs/api.d.ts +0 -3
- package/es/UserCenter/libs/api.js +0 -4
- package/es/UserCenter/libs/locales.d.ts +0 -162
- package/es/UserCenter/libs/locales.js +0 -162
- package/es/UserCenter/libs/utils.d.ts +0 -4
- package/es/UserCenter/libs/utils.js +0 -14
- package/es/UserSessions/components/user-session-info.d.ts +0 -6
- package/es/UserSessions/components/user-session-info.js +0 -92
- package/es/UserSessions/components/user-sessions.d.ts +0 -9
- package/es/UserSessions/components/user-sessions.js +0 -265
- package/es/UserSessions/index.d.ts +0 -1
- package/es/UserSessions/index.js +0 -1
- package/es/UserSessions/libs/locales.d.ts +0 -58
- package/es/UserSessions/libs/locales.js +0 -58
- package/es/UserSessions/libs/utils.d.ts +0 -2
- package/es/UserSessions/libs/utils.js +0 -73
- package/es/blocklets.d.ts +0 -16
- package/es/blocklets.js +0 -178
- package/es/common/header-addons.d.ts +0 -21
- package/es/common/header-addons.js +0 -83
- package/es/common/link-blocker.d.ts +0 -7
- package/es/common/link-blocker.js +0 -18
- package/es/common/overridable-theme-provider.d.ts +0 -18
- package/es/common/overridable-theme-provider.js +0 -15
- package/es/common/wallet-hidden-topbar.d.ts +0 -1
- package/es/common/wallet-hidden-topbar.js +0 -14
- package/es/contexts/config-user-space.d.ts +0 -26
- package/es/contexts/config-user-space.js +0 -53
- package/es/hooks/use-mobile.d.ts +0 -4
- package/es/hooks/use-mobile.js +0 -5
- package/es/index.d.ts +0 -10
- package/es/index.js +0 -10
- package/es/libs/client.d.ts +0 -2
- package/es/libs/client.js +0 -2
- package/es/libs/spaces.d.ts +0 -2
- package/es/libs/spaces.js +0 -13
- package/es/types.d.ts +0 -2
- package/es/types.js +0 -43
- package/es/utils.d.ts +0 -8
- package/es/utils.js +0 -78
package/lib/Footer/index.js
CHANGED
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _utils = require("../utils");
|
|
19
|
-
var _blocklets = require("../blocklets");
|
|
20
|
-
var _types = require("../types");
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
function Footer({
|
|
23
|
-
meta,
|
|
24
|
-
theme: themeOverrides,
|
|
25
|
-
...rest
|
|
26
|
-
}) {
|
|
27
|
-
const {
|
|
28
|
-
locale
|
|
29
|
-
} = (0, _context.useLocaleContext)() || {};
|
|
30
|
-
const formattedBlocklet = (0, _react.useMemo)(() => {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
+
import { withErrorBoundary } from "react-error-boundary";
|
|
6
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
|
|
8
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
9
|
+
import omit from "lodash/omit";
|
|
10
|
+
import OverridableThemeProvider from "../common/overridable-theme-provider.js";
|
|
11
|
+
import InternalFooter from "./internal-footer.js";
|
|
12
|
+
import { mapRecursive } from "../utils.js";
|
|
13
|
+
import { formatBlockletInfo, getLocalizedNavigation } from "../blocklets.js";
|
|
14
|
+
import { BlockletMetaProps } from "../types.js";
|
|
15
|
+
function Footer({ meta, theme: themeOverrides, ...rest }) {
|
|
16
|
+
const { locale } = useLocaleContext() || {};
|
|
17
|
+
const formattedBlocklet = useMemo(() => {
|
|
31
18
|
const blocklet = Object.assign({}, window.blocklet, meta);
|
|
32
19
|
try {
|
|
33
|
-
return
|
|
20
|
+
return formatBlockletInfo(blocklet);
|
|
34
21
|
} catch (e) {
|
|
35
22
|
console.error("Failed to format blocklet info", e, blocklet);
|
|
36
23
|
return blocklet;
|
|
@@ -39,19 +26,11 @@ function Footer({
|
|
|
39
26
|
if (!formattedBlocklet.appName) {
|
|
40
27
|
return null;
|
|
41
28
|
}
|
|
42
|
-
const {
|
|
43
|
-
appLogo,
|
|
44
|
-
appLogoRect,
|
|
45
|
-
appName,
|
|
46
|
-
appDescription,
|
|
47
|
-
description,
|
|
48
|
-
theme,
|
|
49
|
-
copyright
|
|
50
|
-
} = formattedBlocklet;
|
|
29
|
+
const { appLogo, appLogoRect, appName, appDescription, description, theme, copyright } = formattedBlocklet;
|
|
51
30
|
const localized = {
|
|
52
|
-
footerNav:
|
|
53
|
-
socialMedia:
|
|
54
|
-
links:
|
|
31
|
+
footerNav: getLocalizedNavigation(formattedBlocklet?.navigation?.footer, locale) || [],
|
|
32
|
+
socialMedia: getLocalizedNavigation(formattedBlocklet?.navigation?.social, locale) || [],
|
|
33
|
+
links: getLocalizedNavigation(formattedBlocklet?.navigation?.bottom, locale) || []
|
|
55
34
|
};
|
|
56
35
|
const props = {
|
|
57
36
|
brand: {
|
|
@@ -59,48 +38,45 @@ function Footer({
|
|
|
59
38
|
description: appDescription || description,
|
|
60
39
|
logo: appLogoRect || appLogo
|
|
61
40
|
},
|
|
62
|
-
navigation:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
navigation: mapRecursive(
|
|
42
|
+
localized.footerNav,
|
|
43
|
+
(item) => ({
|
|
44
|
+
...item,
|
|
45
|
+
label: item.title,
|
|
46
|
+
link: item.link
|
|
47
|
+
}),
|
|
48
|
+
"items"
|
|
49
|
+
),
|
|
67
50
|
copyright,
|
|
68
51
|
socialMedia: localized.socialMedia,
|
|
69
|
-
links: localized.links.map(item => ({
|
|
70
|
-
...item,
|
|
71
|
-
label: item.title
|
|
72
|
-
}))
|
|
52
|
+
links: localized.links.map((item) => ({ ...item, label: item.title }))
|
|
73
53
|
};
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
return /* @__PURE__ */ jsx(OverridableThemeProvider, { theme: themeOverrides, children: /* @__PURE__ */ jsx(
|
|
55
|
+
StyledInternalFooter,
|
|
56
|
+
{
|
|
77
57
|
...props,
|
|
78
|
-
...(
|
|
58
|
+
...omit(rest, ["bordered"]),
|
|
79
59
|
$bordered: rest?.bordered,
|
|
80
60
|
$bgcolor: theme?.background?.footer
|
|
81
|
-
}
|
|
82
|
-
});
|
|
61
|
+
}
|
|
62
|
+
) });
|
|
83
63
|
}
|
|
84
64
|
Footer.propTypes = {
|
|
85
|
-
meta:
|
|
65
|
+
meta: BlockletMetaProps,
|
|
86
66
|
// 允许覆盖 footer 内置的 theme
|
|
87
|
-
theme:
|
|
67
|
+
theme: PropTypes.object
|
|
88
68
|
};
|
|
89
69
|
Footer.defaultProps = {
|
|
90
70
|
meta: {},
|
|
91
71
|
theme: null
|
|
92
72
|
};
|
|
93
|
-
const StyledInternalFooter =
|
|
94
|
-
${({
|
|
95
|
-
$
|
|
96
|
-
}) => `
|
|
97
|
-
color: ${props => props.theme.palette.grey[600]};
|
|
98
|
-
${({
|
|
99
|
-
$bgcolor
|
|
100
|
-
}) => $bgcolor && `background-color: ${$bgcolor};`}
|
|
73
|
+
const StyledInternalFooter = styled(InternalFooter)`
|
|
74
|
+
${({ $bordered }) => `border-top: 1px solid ${$bordered ? colors.strokeSep : "#eee"};`}
|
|
75
|
+
color: ${(props) => props.theme.palette.grey[600]};
|
|
76
|
+
${({ $bgcolor }) => $bgcolor && `background-color: ${$bgcolor};`}
|
|
101
77
|
font-family: Inter, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
|
102
78
|
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
103
79
|
`;
|
|
104
|
-
|
|
105
|
-
FallbackComponent:
|
|
106
|
-
});
|
|
80
|
+
export default withErrorBoundary(Footer, {
|
|
81
|
+
FallbackComponent: ErrorFallback
|
|
82
|
+
});
|
|
@@ -1,74 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
support: () => true,
|
|
26
|
-
component: _standard.default
|
|
27
|
-
}];
|
|
28
|
-
const layoutsKeyByName = layouts.reduce((acc, cur) => ({
|
|
29
|
-
...acc,
|
|
30
|
-
[cur.name]: cur
|
|
31
|
-
}), {});
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import Brand from "./brand.js";
|
|
5
|
+
import Links from "./links.js";
|
|
6
|
+
import SocialMedia from "./social-media.js";
|
|
7
|
+
import Copyright from "./copyright.js";
|
|
8
|
+
import StandardLayout from "./layout/standard.js";
|
|
9
|
+
import PlainLayout from "./layout/plain.js";
|
|
10
|
+
const layouts = [
|
|
11
|
+
{
|
|
12
|
+
name: "plain",
|
|
13
|
+
// navigation 数据为空时, 使用简单布局
|
|
14
|
+
support: (_, data) => !data.navigation?.length && !data.socialMedia?.length,
|
|
15
|
+
component: PlainLayout
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "standard",
|
|
19
|
+
// 默认标准布局
|
|
20
|
+
support: () => true,
|
|
21
|
+
component: StandardLayout
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
const layoutsKeyByName = layouts.reduce((acc, cur) => ({ ...acc, [cur.name]: cur }), {});
|
|
32
25
|
function InternalFooter(props) {
|
|
33
|
-
const {
|
|
34
|
-
brand,
|
|
35
|
-
navigation,
|
|
36
|
-
socialMedia,
|
|
37
|
-
copyright,
|
|
38
|
-
links,
|
|
39
|
-
layout,
|
|
40
|
-
...rest
|
|
41
|
-
} = props;
|
|
26
|
+
const { brand, navigation, socialMedia, copyright, links, layout, ...rest } = props;
|
|
42
27
|
const renderBrand = () => {
|
|
43
|
-
return brand ? /* @__PURE__ */
|
|
44
|
-
...brand
|
|
45
|
-
}) : null;
|
|
28
|
+
return brand ? /* @__PURE__ */ jsx(Brand, { ...brand }) : null;
|
|
46
29
|
};
|
|
47
30
|
const renderNavigation = () => {
|
|
48
|
-
return navigation?.length ? /* @__PURE__ */
|
|
49
|
-
links: navigation
|
|
50
|
-
}) : null;
|
|
31
|
+
return navigation?.length ? /* @__PURE__ */ jsx(Links, { links: navigation }) : null;
|
|
51
32
|
};
|
|
52
33
|
const renderSocialMedia = () => {
|
|
53
|
-
return socialMedia?.length ? /* @__PURE__ */
|
|
54
|
-
items: socialMedia
|
|
55
|
-
}) : null;
|
|
34
|
+
return socialMedia?.length ? /* @__PURE__ */ jsx(SocialMedia, { items: socialMedia }) : null;
|
|
56
35
|
};
|
|
57
36
|
const renderCopyright = () => {
|
|
58
37
|
const copyrightOwner = copyright?.owner || brand?.name;
|
|
59
38
|
if (!copyrightOwner) {
|
|
60
39
|
return null;
|
|
61
40
|
}
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
owner: copyrightOwner,
|
|
64
|
-
year: copyright?.year || void 0
|
|
65
|
-
});
|
|
41
|
+
return /* @__PURE__ */ jsx(Copyright, { owner: copyrightOwner, year: copyright?.year || void 0 });
|
|
66
42
|
};
|
|
67
43
|
const renderLinks = () => {
|
|
68
|
-
return links?.length ? /* @__PURE__ */
|
|
69
|
-
flowLayout: true,
|
|
70
|
-
links
|
|
71
|
-
}) : null;
|
|
44
|
+
return links?.length ? /* @__PURE__ */ jsx(Links, { flowLayout: true, links }) : null;
|
|
72
45
|
};
|
|
73
46
|
const elements = {
|
|
74
47
|
brand: renderBrand(),
|
|
@@ -79,60 +52,59 @@ function InternalFooter(props) {
|
|
|
79
52
|
};
|
|
80
53
|
let LayoutComponent = null;
|
|
81
54
|
if (layout === "auto") {
|
|
82
|
-
LayoutComponent = layouts.find(item => item.support(elements, props)).component;
|
|
55
|
+
LayoutComponent = layouts.find((item) => item.support(elements, props)).component;
|
|
83
56
|
} else {
|
|
84
57
|
LayoutComponent = layoutsKeyByName[layout]?.component;
|
|
85
58
|
}
|
|
86
59
|
if (!LayoutComponent) {
|
|
87
60
|
throw new Error(`layout ${layout} is not supported.`);
|
|
88
61
|
}
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
background: "#000",
|
|
104
|
-
color: "#fff"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
children: window?.blocklet?.version
|
|
108
|
-
})]
|
|
109
|
-
});
|
|
62
|
+
return /* @__PURE__ */ jsxs(Box, { position: "relative", ...rest, children: [
|
|
63
|
+
/* @__PURE__ */ jsx(LayoutComponent, { elements, data: props }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
Box,
|
|
66
|
+
{
|
|
67
|
+
position: "absolute",
|
|
68
|
+
right: 16,
|
|
69
|
+
bottom: 0,
|
|
70
|
+
fontSize: 12,
|
|
71
|
+
sx: { color: "transparent", "::selection": { background: "#000", color: "#fff" } },
|
|
72
|
+
children: window?.blocklet?.version
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] });
|
|
110
76
|
}
|
|
111
77
|
InternalFooter.propTypes = {
|
|
112
|
-
brand:
|
|
113
|
-
name:
|
|
114
|
-
description:
|
|
115
|
-
logo:
|
|
78
|
+
brand: PropTypes.shape({
|
|
79
|
+
name: PropTypes.node,
|
|
80
|
+
description: PropTypes.string,
|
|
81
|
+
logo: PropTypes.node
|
|
116
82
|
}),
|
|
117
|
-
navigation:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
83
|
+
navigation: PropTypes.arrayOf(
|
|
84
|
+
PropTypes.shape({
|
|
85
|
+
label: PropTypes.node,
|
|
86
|
+
link: PropTypes.string
|
|
87
|
+
})
|
|
88
|
+
),
|
|
89
|
+
socialMedia: PropTypes.arrayOf(
|
|
90
|
+
PropTypes.shape({
|
|
91
|
+
icon: PropTypes.node,
|
|
92
|
+
link: PropTypes.string
|
|
93
|
+
})
|
|
94
|
+
),
|
|
95
|
+
copyright: PropTypes.shape({
|
|
96
|
+
owner: PropTypes.string,
|
|
97
|
+
year: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
128
98
|
}),
|
|
129
99
|
// privacy/legal 等链接, 常放于 footer 右下侧或最底部
|
|
130
|
-
links:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
100
|
+
links: PropTypes.arrayOf(
|
|
101
|
+
PropTypes.shape({
|
|
102
|
+
label: PropTypes.node,
|
|
103
|
+
link: PropTypes.string
|
|
104
|
+
})
|
|
105
|
+
),
|
|
134
106
|
// 可显式指定 footer layout, 默认根据内容自动决定 layout
|
|
135
|
-
layout:
|
|
107
|
+
layout: PropTypes.oneOf(["auto", "standard", "plain"])
|
|
136
108
|
};
|
|
137
109
|
InternalFooter.defaultProps = {
|
|
138
110
|
brand: null,
|
|
@@ -142,4 +114,4 @@ InternalFooter.defaultProps = {
|
|
|
142
114
|
links: null,
|
|
143
115
|
layout: "auto"
|
|
144
116
|
};
|
|
145
|
-
|
|
117
|
+
export default InternalFooter;
|
|
@@ -1,51 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Root, {
|
|
20
|
-
...rest,
|
|
21
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_Container.default, {
|
|
22
|
-
className: "plain-layout-container",
|
|
23
|
-
children: [!!data.links && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_row.default, {
|
|
24
|
-
sx: {
|
|
25
|
-
width: 1
|
|
26
|
-
},
|
|
27
|
-
autoCenter: true,
|
|
28
|
-
children: [elements.copyright, elements.links]
|
|
29
|
-
}), !data.links && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
30
|
-
children: [(0, _react.cloneElement)(elements.brand, {
|
|
31
|
-
name: null,
|
|
32
|
-
description: null
|
|
33
|
-
}), elements.copyright]
|
|
34
|
-
})]
|
|
35
|
-
})
|
|
36
|
-
});
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import Container from "@mui/material/Container";
|
|
5
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
6
|
+
import Row from "./row.js";
|
|
7
|
+
function PlainLayout({ elements, data, ...rest }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Root, { ...rest, children: /* @__PURE__ */ jsxs(Container, { className: "plain-layout-container", children: [
|
|
9
|
+
!!data.links && /* @__PURE__ */ jsxs(Row, { sx: { width: 1 }, autoCenter: true, children: [
|
|
10
|
+
elements.copyright,
|
|
11
|
+
elements.links
|
|
12
|
+
] }),
|
|
13
|
+
!data.links && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
+
cloneElement(elements.brand, { name: null, description: null }),
|
|
15
|
+
elements.copyright
|
|
16
|
+
] })
|
|
17
|
+
] }) });
|
|
37
18
|
}
|
|
38
19
|
PlainLayout.propTypes = {
|
|
39
|
-
elements:
|
|
40
|
-
brand:
|
|
41
|
-
navigation:
|
|
42
|
-
socialMedia:
|
|
43
|
-
copyright:
|
|
44
|
-
links:
|
|
20
|
+
elements: PropTypes.shape({
|
|
21
|
+
brand: PropTypes.element,
|
|
22
|
+
navigation: PropTypes.element,
|
|
23
|
+
socialMedia: PropTypes.element,
|
|
24
|
+
copyright: PropTypes.element,
|
|
25
|
+
links: PropTypes.element
|
|
45
26
|
}).isRequired,
|
|
46
|
-
data:
|
|
27
|
+
data: PropTypes.object.isRequired
|
|
47
28
|
};
|
|
48
|
-
const Root =
|
|
29
|
+
const Root = styled("div")`
|
|
49
30
|
padding: 24px 0;
|
|
50
31
|
.plain-layout-container {
|
|
51
32
|
display: flex;
|
|
@@ -55,4 +36,4 @@ const Root = (0, _Theme.styled)("div")`
|
|
|
55
36
|
gap: 8px;
|
|
56
37
|
}
|
|
57
38
|
`;
|
|
58
|
-
|
|
39
|
+
export default PlainLayout;
|
package/lib/Footer/layout/row.js
CHANGED
|
@@ -1,40 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
10
|
-
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
11
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
function Row({
|
|
14
|
-
children,
|
|
15
|
-
autoCenter,
|
|
16
|
-
...rest
|
|
17
|
-
}) {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
export default function Row({ children, autoCenter, ...rest }) {
|
|
18
7
|
if (!children) {
|
|
19
8
|
return null;
|
|
20
9
|
}
|
|
21
|
-
return /* @__PURE__ */(
|
|
22
|
-
...rest,
|
|
23
|
-
className: (0, _clsx.default)(rest.className, {
|
|
24
|
-
"footer-row-auto-center": autoCenter
|
|
25
|
-
}),
|
|
26
|
-
children
|
|
27
|
-
});
|
|
10
|
+
return /* @__PURE__ */ jsx(RowRoot, { ...rest, className: clsx(rest.className, { "footer-row-auto-center": autoCenter }), children });
|
|
28
11
|
}
|
|
29
12
|
Row.propTypes = {
|
|
30
|
-
children:
|
|
31
|
-
autoCenter:
|
|
13
|
+
children: PropTypes.any,
|
|
14
|
+
autoCenter: PropTypes.bool
|
|
32
15
|
};
|
|
33
16
|
Row.defaultProps = {
|
|
34
17
|
children: null,
|
|
35
18
|
autoCenter: false
|
|
36
19
|
};
|
|
37
|
-
const RowRoot =
|
|
20
|
+
const RowRoot = styled(Box)`
|
|
38
21
|
display: flex;
|
|
39
22
|
justify-content: space-between;
|
|
40
23
|
& + & {
|
|
@@ -44,7 +27,7 @@ const RowRoot = (0, _Theme.styled)(_Box.default)`
|
|
|
44
27
|
margin: 0 auto;
|
|
45
28
|
}
|
|
46
29
|
|
|
47
|
-
${props => props.theme.breakpoints.down("md")} {
|
|
30
|
+
${(props) => props.theme.breakpoints.down("md")} {
|
|
48
31
|
align-items: stretch;
|
|
49
32
|
flex-direction: column;
|
|
50
33
|
gap: 16px;
|
|
@@ -55,4 +38,4 @@ const RowRoot = (0, _Theme.styled)(_Box.default)`
|
|
|
55
38
|
margin: 0 auto;
|
|
56
39
|
}
|
|
57
40
|
}
|
|
58
|
-
`;
|
|
41
|
+
`;
|
|
@@ -1,76 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _row = _interopRequireDefault(require("./row"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function StandardLayout({
|
|
15
|
-
elements,
|
|
16
|
-
data,
|
|
17
|
-
...rest
|
|
18
|
-
}) {
|
|
19
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(Root, {
|
|
20
|
-
...rest,
|
|
21
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_Container.default, {
|
|
22
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import Container from "@mui/material/Container";
|
|
5
|
+
import { styled } from "@arcblock/ux/lib/Theme";
|
|
6
|
+
import Row from "./row.js";
|
|
7
|
+
function StandardLayout({ elements, data, ...rest }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Root, { ...rest, children: /* @__PURE__ */ jsxs(Container, { children: [
|
|
9
|
+
/* @__PURE__ */ jsxs(
|
|
10
|
+
Box,
|
|
11
|
+
{
|
|
23
12
|
sx: {
|
|
24
13
|
display: "flex",
|
|
25
|
-
flexDirection: {
|
|
26
|
-
xs: "column",
|
|
27
|
-
md: "row"
|
|
28
|
-
},
|
|
14
|
+
flexDirection: { xs: "column", md: "row" },
|
|
29
15
|
justifyContent: "space-between",
|
|
30
|
-
alignItems: {
|
|
31
|
-
xs: "center",
|
|
32
|
-
md: "space-between"
|
|
33
|
-
},
|
|
16
|
+
alignItems: { xs: "center", md: "space-between" },
|
|
34
17
|
gap: 2,
|
|
35
18
|
pb: 3
|
|
36
19
|
},
|
|
37
|
-
children: [
|
|
38
|
-
children: elements.brand
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
children: elements.navigation
|
|
51
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_row.default, {
|
|
52
|
-
sx: {
|
|
53
|
-
pt: 3,
|
|
54
|
-
borderTop: 1,
|
|
55
|
-
borderColor: "grey.200"
|
|
56
|
-
},
|
|
57
|
-
autoCenter: true,
|
|
58
|
-
children: [elements.copyright, elements.links]
|
|
59
|
-
})]
|
|
60
|
-
})
|
|
61
|
-
});
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Box, { children: elements.brand }),
|
|
22
|
+
/* @__PURE__ */ jsx(Box, { lineHeight: 1, children: elements.socialMedia })
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
!!data.navigation?.length && /* @__PURE__ */ jsx(Box, { sx: { mb: 6, pt: 3, borderTop: 1, borderColor: "grey.200" }, children: elements.navigation }),
|
|
27
|
+
/* @__PURE__ */ jsxs(Row, { sx: { pt: 3, borderTop: 1, borderColor: "grey.200" }, autoCenter: true, children: [
|
|
28
|
+
elements.copyright,
|
|
29
|
+
elements.links
|
|
30
|
+
] })
|
|
31
|
+
] }) });
|
|
62
32
|
}
|
|
63
33
|
StandardLayout.propTypes = {
|
|
64
|
-
elements:
|
|
65
|
-
brand:
|
|
66
|
-
navigation:
|
|
67
|
-
socialMedia:
|
|
68
|
-
copyright:
|
|
69
|
-
links:
|
|
34
|
+
elements: PropTypes.shape({
|
|
35
|
+
brand: PropTypes.element,
|
|
36
|
+
navigation: PropTypes.element,
|
|
37
|
+
socialMedia: PropTypes.element,
|
|
38
|
+
copyright: PropTypes.element,
|
|
39
|
+
links: PropTypes.element
|
|
70
40
|
}).isRequired,
|
|
71
|
-
data:
|
|
41
|
+
data: PropTypes.object.isRequired
|
|
72
42
|
};
|
|
73
|
-
const Root =
|
|
43
|
+
const Root = styled("div")`
|
|
74
44
|
padding: 32px 0 24px 0;
|
|
75
45
|
.footer-brand-name,
|
|
76
46
|
.footer-brand-desc {
|
|
@@ -80,4 +50,4 @@ const Root = (0, _Theme.styled)("div")`
|
|
|
80
50
|
margin-right: 0;
|
|
81
51
|
}
|
|
82
52
|
`;
|
|
83
|
-
|
|
53
|
+
export default StandardLayout;
|