@blocklet/ui-react 3.4.14 → 3.5.0
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/common/org-switch/use-org.d.ts +4 -4
- package/lib/common/ws.d.ts +22 -1
- package/package.json +10 -7
- package/.aigne/doc-smith/.local/afs-storage.sqlite3 +0 -0
- package/.aigne/doc-smith/config.yaml +0 -78
- package/.aigne/doc-smith/history.yaml +0 -14
- package/.aigne/doc-smith/media-description.yaml +0 -11
- package/.aigne/doc-smith/output/structure-plan.json +0 -255
- package/.aigne/doc-smith/translation-cache.yaml +0 -11
- package/.aigne/doc-smith/upload-cache.yaml +0 -528
- package/build.config.ts +0 -24
- package/docs/_sidebar.md +0 -19
- package/docs/assets/diagram/component-installer-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-installer-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/component-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-concepts-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/dashboard-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/header-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/layout-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/notifications-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-center-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-management-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/user-sessions-diagram-0.zh.jpg +0 -0
- package/docs/components-component-management-blocklet-studio.ja.md +0 -194
- package/docs/components-component-management-blocklet-studio.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh-TW.md +0 -194
- package/docs/components-component-management-blocklet-studio.zh.md +0 -194
- package/docs/components-component-management-component-installer.ja.md +0 -182
- package/docs/components-component-management-component-installer.md +0 -182
- package/docs/components-component-management-component-installer.zh-TW.md +0 -182
- package/docs/components-component-management-component-installer.zh.md +0 -182
- package/docs/components-component-management.ja.md +0 -30
- package/docs/components-component-management.md +0 -30
- package/docs/components-component-management.zh-TW.md +0 -30
- package/docs/components-component-management.zh.md +0 -30
- package/docs/components-layout-dashboard.ja.md +0 -185
- package/docs/components-layout-dashboard.md +0 -187
- package/docs/components-layout-dashboard.zh-TW.md +0 -185
- package/docs/components-layout-dashboard.zh.md +0 -185
- package/docs/components-layout-footer.ja.md +0 -165
- package/docs/components-layout-footer.md +0 -165
- package/docs/components-layout-footer.zh-TW.md +0 -165
- package/docs/components-layout-footer.zh.md +0 -165
- package/docs/components-layout-header.ja.md +0 -183
- package/docs/components-layout-header.md +0 -183
- package/docs/components-layout-header.zh-TW.md +0 -183
- package/docs/components-layout-header.zh.md +0 -183
- package/docs/components-layout.ja.md +0 -31
- package/docs/components-layout.md +0 -31
- package/docs/components-layout.zh-TW.md +0 -31
- package/docs/components-layout.zh.md +0 -31
- package/docs/components-notifications.ja.md +0 -125
- package/docs/components-notifications.md +0 -125
- package/docs/components-notifications.zh-TW.md +0 -125
- package/docs/components-notifications.zh.md +0 -125
- package/docs/components-user-management-user-center.ja.md +0 -148
- package/docs/components-user-management-user-center.md +0 -147
- package/docs/components-user-management-user-center.zh-TW.md +0 -148
- package/docs/components-user-management-user-center.zh.md +0 -148
- package/docs/components-user-management-user-sessions.ja.md +0 -121
- package/docs/components-user-management-user-sessions.md +0 -123
- package/docs/components-user-management-user-sessions.zh-TW.md +0 -121
- package/docs/components-user-management-user-sessions.zh.md +0 -121
- package/docs/components-user-management.ja.md +0 -49
- package/docs/components-user-management.md +0 -51
- package/docs/components-user-management.zh-TW.md +0 -49
- package/docs/components-user-management.zh.md +0 -49
- package/docs/components-utilities-icon.ja.md +0 -106
- package/docs/components-utilities-icon.md +0 -106
- package/docs/components-utilities-icon.zh-TW.md +0 -106
- package/docs/components-utilities-icon.zh.md +0 -106
- package/docs/components-utilities.ja.md +0 -136
- package/docs/components-utilities.md +0 -136
- package/docs/components-utilities.zh-TW.md +0 -136
- package/docs/components-utilities.zh.md +0 -136
- package/docs/components.ja.md +0 -27
- package/docs/components.md +0 -27
- package/docs/components.zh-TW.md +0 -27
- package/docs/components.zh.md +0 -27
- package/docs/core-concepts.ja.md +0 -134
- package/docs/core-concepts.md +0 -135
- package/docs/core-concepts.zh-TW.md +0 -134
- package/docs/core-concepts.zh.md +0 -134
- package/docs/getting-started.ja.md +0 -132
- package/docs/getting-started.md +0 -132
- package/docs/getting-started.zh-TW.md +0 -132
- package/docs/getting-started.zh.md +0 -132
- package/docs/hooks-api.ja.md +0 -214
- package/docs/hooks-api.md +0 -214
- package/docs/hooks-api.zh-TW.md +0 -214
- package/docs/hooks-api.zh.md +0 -214
- package/docs/how-to-guides.ja.md +0 -413
- package/docs/how-to-guides.md +0 -413
- package/docs/how-to-guides.zh-TW.md +0 -413
- package/docs/how-to-guides.zh.md +0 -413
- package/docs/overview.ja.md +0 -51
- package/docs/overview.md +0 -51
- package/docs/overview.zh-TW.md +0 -51
- package/docs/overview.zh.md +0 -51
- package/glossary.md +0 -12
- package/src/@types/index.ts +0 -230
- package/src/@types/shims.d.ts +0 -18
- package/src/BlockletStudio/README.md +0 -116
- package/src/BlockletStudio/index.tsx +0 -145
- package/src/ComponentInstaller/ComponentInstaller.stories.jsx +0 -16
- package/src/ComponentInstaller/index.jsx +0 -207
- package/src/ComponentInstaller/installer-item.jsx +0 -129
- package/src/ComponentInstaller/locales.js +0 -22
- package/src/ComponentInstaller/use-component-installed.js +0 -88
- package/src/ComponentManager/components/add-component.tsx +0 -136
- package/src/ComponentManager/components/check-component.tsx +0 -3
- package/src/ComponentManager/components/publish-component.tsx +0 -90
- package/src/ComponentManager/components/resource-dialog.tsx +0 -91
- package/src/ComponentManager/index.tsx +0 -3
- package/src/ComponentManager/libs/locales.ts +0 -15
- package/src/Dashboard/Dashboard.stories.jsx +0 -20
- package/src/Dashboard/app-shell/app-badge.stories.tsx +0 -64
- package/src/Dashboard/app-shell/app-badge.tsx +0 -94
- package/src/Dashboard/app-shell/app-header.tsx +0 -104
- package/src/Dashboard/app-shell/app-info-context.tsx +0 -182
- package/src/Dashboard/app-shell/badges/app-badge-default.tsx +0 -130
- package/src/Dashboard/app-shell/badges/app-badge-did.tsx +0 -28
- package/src/Dashboard/app-shell/badges/app-badge-state.tsx +0 -40
- package/src/Dashboard/app-shell/badges/app-badge-switch.tsx +0 -72
- package/src/Dashboard/app-shell/badges/app-badge-version.tsx +0 -60
- package/src/Dashboard/app-shell/index.ts +0 -5
- package/src/Dashboard/index.jsx +0 -184
- package/src/Footer/Footer.stories.jsx +0 -33
- package/src/Footer/brand.jsx +0 -81
- package/src/Footer/copyright.jsx +0 -22
- package/src/Footer/index.jsx +0 -111
- package/src/Footer/internal-footer.jsx +0 -139
- package/src/Footer/layout/plain.jsx +0 -55
- package/src/Footer/layout/row.jsx +0 -43
- package/src/Footer/layout/standard.jsx +0 -114
- package/src/Footer/links.jsx +0 -321
- package/src/Footer/social-media.jsx +0 -55
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/index.tsx +0 -259
- package/src/Icon/Icon.stories.jsx +0 -12
- package/src/Icon/index.tsx +0 -87
- package/src/Notifications/Snackbar.tsx +0 -261
- package/src/Notifications/hooks/use-title.tsx +0 -254
- package/src/Notifications/hooks/use-width.tsx +0 -16
- package/src/Notifications/utils.ts +0 -246
- package/src/UserCenter/assets/banner.png +0 -0
- package/src/UserCenter/components/config-inviter.tsx +0 -48
- package/src/UserCenter/components/config-profile.tsx +0 -99
- package/src/UserCenter/components/danger-zone.tsx +0 -82
- package/src/UserCenter/components/editable-field.tsx +0 -273
- package/src/UserCenter/components/fallback.tsx +0 -57
- package/src/UserCenter/components/nft-preview.tsx +0 -84
- package/src/UserCenter/components/nft.tsx +0 -279
- package/src/UserCenter/components/notification.tsx +0 -319
- package/src/UserCenter/components/passport.tsx +0 -107
- package/src/UserCenter/components/privacy.tsx +0 -120
- package/src/UserCenter/components/settings.tsx +0 -170
- package/src/UserCenter/components/status-dialog/date-picker.tsx +0 -77
- package/src/UserCenter/components/status-dialog/index.tsx +0 -293
- package/src/UserCenter/components/status-selector/duration-menu.tsx +0 -90
- package/src/UserCenter/components/status-selector/index.tsx +0 -58
- package/src/UserCenter/components/status-selector/menu-item.tsx +0 -56
- package/src/UserCenter/components/storage/action.tsx +0 -49
- package/src/UserCenter/components/storage/connected.tsx +0 -61
- package/src/UserCenter/components/storage/delete.tsx +0 -72
- package/src/UserCenter/components/storage/disconnect.tsx +0 -40
- package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -1
- package/src/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/src/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/src/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/src/UserCenter/components/storage/index.tsx +0 -41
- package/src/UserCenter/components/storage/preview-nft.tsx +0 -72
- package/src/UserCenter/components/third-party-login/index.tsx +0 -199
- package/src/UserCenter/components/third-party-login/third-party-item.tsx +0 -296
- package/src/UserCenter/components/user-center.tsx +0 -787
- package/src/UserCenter/components/user-info/address.tsx +0 -143
- package/src/UserCenter/components/user-info/index.tsx +0 -4
- package/src/UserCenter/components/user-info/link-preview-input.tsx +0 -274
- package/src/UserCenter/components/user-info/metadata.tsx +0 -658
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +0 -43
- package/src/UserCenter/components/user-info/social-actions/follow.tsx +0 -23
- package/src/UserCenter/components/user-info/social-actions/index.tsx +0 -17
- package/src/UserCenter/components/user-info/switch-role.tsx +0 -42
- package/src/UserCenter/components/user-info/timezone-select.tsx +0 -119
- package/src/UserCenter/components/user-info/user-basic-info.tsx +0 -292
- package/src/UserCenter/components/user-info/user-info-item.tsx +0 -54
- package/src/UserCenter/components/user-info/user-info.tsx +0 -91
- package/src/UserCenter/components/user-info/user-status.tsx +0 -234
- package/src/UserCenter/components/user-info/utils.ts +0 -320
- package/src/UserCenter/components/webhook-item.tsx +0 -248
- package/src/UserCenter/index.tsx +0 -1
- package/src/UserCenter/libs/locales.ts +0 -378
- package/src/UserCenter/libs/utils.ts +0 -30
- package/src/UserSessions/components/user-session-info.tsx +0 -78
- package/src/UserSessions/components/user-sessions.tsx +0 -545
- package/src/UserSessions/index.tsx +0 -1
- package/src/UserSessions/libs/locales.ts +0 -60
- package/src/UserSessions/libs/utils.ts +0 -82
- package/src/blocklets.js +0 -195
- package/src/common/domain-warning.jsx +0 -178
- package/src/common/header-addons.jsx +0 -119
- package/src/common/link-blocker.jsx +0 -20
- package/src/common/notification-addon.jsx +0 -135
- package/src/common/org-switch/avatar-uploader.jsx +0 -271
- package/src/common/org-switch/create.jsx +0 -267
- package/src/common/org-switch/index.jsx +0 -407
- package/src/common/org-switch/locales.js +0 -52
- package/src/common/org-switch/use-org.jsx +0 -79
- package/src/common/overridable-theme-provider.jsx +0 -17
- package/src/common/wallet-hidden-topbar.js +0 -14
- package/src/common/wizard-modal.jsx +0 -200
- package/src/common/ws.js +0 -68
- package/src/contexts/config-user-space.tsx +0 -88
- package/src/contexts/user-followers.tsx +0 -54
- package/src/hooks/use-follow.tsx +0 -75
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -16
- package/src/libs/constant.ts +0 -1
- package/src/libs/spaces.tsx +0 -18
- package/src/libs/with-hide-when-embed.tsx +0 -24
- package/src/types.js +0 -45
- package/src/utils.js +0 -161
- package/vite.config.mjs +0 -34
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
# Dashboard
|
|
2
|
-
|
|
3
|
-
`Dashboard` 组件为 blocklet 应用程序提供了一个预构建的响应式布局,通常用于管理界面或以用户为中心的视图。它通过解析 blocklet 的元数据,自动构建一个包含侧边栏、头部和主内容区域的标准仪表盘。该组件显著减少了构建常见应用程序结构的样板代码。
|
|
4
|
-
|
|
5
|
-
该布局由三个主要部分组成:一个用于导航的持久侧边栏,一个用于全局操作和用户信息的头部,以及一个渲染特定页面内容的主内容区域。
|
|
6
|
-
|
|
7
|
-
<!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
|
|
8
|
-

|
|
9
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
10
|
-
|
|
11
|
-
## 基本用法
|
|
12
|
-
|
|
13
|
-
要使用 `Dashboard` 组件,只需用它包裹页面内容即可。该组件将自动在您的内容周围渲染头部和侧边栏。
|
|
14
|
-
|
|
15
|
-
```javascript MyDashboard.jsx icon=logos:react
|
|
16
|
-
import Dashboard from '@arcblock/blocklet-ui-react/lib/Dashboard';
|
|
17
|
-
|
|
18
|
-
export default function MyDashboardPage() {
|
|
19
|
-
return (
|
|
20
|
-
<Dashboard>
|
|
21
|
-
<h1>欢迎来到 Dashboard</h1>
|
|
22
|
-
<p>这是您的主内容区域。</p>
|
|
23
|
-
</Dashboard>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
传递给 `Dashboard` 组件的子元素将显示在主内容区域。
|
|
29
|
-
|
|
30
|
-
## 属性
|
|
31
|
-
|
|
32
|
-
`Dashboard` 组件接受以下属性以自定义其行为和外观。
|
|
33
|
-
|
|
34
|
-
<x-field-group>
|
|
35
|
-
<x-field data-name="children" data-type="React.ReactNode" data-required="true">
|
|
36
|
-
<x-field-desc markdown>要在仪表盘布局的主内容区域内渲染的内容。</x-field-desc>
|
|
37
|
-
</x-field>
|
|
38
|
-
<x-field data-name="meta" data-type="object" data-required="false">
|
|
39
|
-
<x-field-desc markdown>一个 blocklet 元数据对象。如果提供,它将与默认的 `window.blocklet` 元数据合并并覆盖后者。这对于测试或动态更改 blocklet 信息非常有用。</x-field-desc>
|
|
40
|
-
</x-field>
|
|
41
|
-
<x-field data-name="fallbackUrl" data-type="string" data-required="false" data-default="publicPath">
|
|
42
|
-
<x-field-desc markdown>如果当前已认证用户根据其角色无权访问任何导航链接,则重定向到此 URL。设置为 `null` 可禁用此自动重定向。</x-field-desc>
|
|
43
|
-
</x-field>
|
|
44
|
-
<x-field data-name="invalidPathFallback" data-type="function" data-required="false">
|
|
45
|
-
<x-field-desc markdown>当当前 URL 路径与任何可用的导航链接都不匹配时执行的回调函数。默认行为是重定向到第一个可用的链接。</x-field-desc>
|
|
46
|
-
</x-field>
|
|
47
|
-
<x-field data-name="headerAddons" data-type="React.ReactNode | function" data-required="false">
|
|
48
|
-
<x-field-desc markdown>允许自定义头部右侧的附加组件。如果提供一个节点,它将替换所有默认的附加组件。如果提供一个函数,它会接收默认附加组件数组作为参数,允许您添加、删除或重新排序它们。</x-field-desc>
|
|
49
|
-
</x-field>
|
|
50
|
-
<x-field data-name="sessionManagerProps" data-type="object" data-required="false">
|
|
51
|
-
<x-field-desc markdown>要直接传递给头部底层 `SessionUser` 组件的属性。这允许自定义用户会话菜单,例如 `showRole` 或定义自定义的 `onLogout` 处理程序。</x-field-desc>
|
|
52
|
-
</x-field>
|
|
53
|
-
<x-field data-name="links" data-type="array | function" data-required="false">
|
|
54
|
-
<x-field-desc markdown>允许以编程方式修改侧边栏导航链接。如果提供一个数组,其项目将附加到从元数据生成的链接后面。如果提供一个函数,它将接收元数据生成的链接作为参数,并应返回一个新的链接数组。</x-field-desc>
|
|
55
|
-
</x-field>
|
|
56
|
-
<x-field data-name="showDomainWarningDialog" data-type="boolean" data-required="false" data-default="true">
|
|
57
|
-
<x-field-desc markdown>如果为 `true`,当应用程序从不受信任的域访问时,将显示一个警告对话框。</x-field-desc>
|
|
58
|
-
</x-field>
|
|
59
|
-
</x-field-group>
|
|
60
|
-
|
|
61
|
-
## 工作原理
|
|
62
|
-
|
|
63
|
-
`Dashboard` 组件被设计为“配置驱动”,其结构和内容主要来源于 blocklet 的元数据文件(`blocklet.yml`)。
|
|
64
|
-
|
|
65
|
-
### 从元数据生成导航
|
|
66
|
-
|
|
67
|
-
侧边栏导航是根据 `blocklet.yml` 中的 `navigation` 数组自动生成的。该组件专门查找其 `section` 属性中包含 `dashboard` 的导航项。
|
|
68
|
-
|
|
69
|
-
以下是如何定义仪表盘导航的示例:
|
|
70
|
-
|
|
71
|
-
```yaml blocklet.yml icon=mdi:file-document
|
|
72
|
-
navigation:
|
|
73
|
-
- title: 'Home'
|
|
74
|
-
link: '/'
|
|
75
|
-
section: 'dashboard'
|
|
76
|
-
icon: 'mdi:home'
|
|
77
|
-
role: ['owner', 'admin', 'guest']
|
|
78
|
-
- title: 'Analytics'
|
|
79
|
-
link: '/analytics'
|
|
80
|
-
section: 'dashboard'
|
|
81
|
-
icon: 'mdi:chart-bar'
|
|
82
|
-
role: ['owner', 'admin']
|
|
83
|
-
- title: 'Settings'
|
|
84
|
-
link: '/settings'
|
|
85
|
-
section: 'dashboard'
|
|
86
|
-
icon: 'mdi:cog'
|
|
87
|
-
role: ['owner']
|
|
88
|
-
items:
|
|
89
|
-
- title: 'Profile'
|
|
90
|
-
link: '/settings/profile'
|
|
91
|
-
- title: 'Billing'
|
|
92
|
-
link: '/settings/billing'
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### 基于角色的访问控制
|
|
96
|
-
|
|
97
|
-
`Dashboard` 组件对导航链接实施基于角色的访问控制(RBAC)。每个导航项可以有一个 `role` 属性,这是一个允许查看该链接的角色数组。
|
|
98
|
-
|
|
99
|
-
- 如果导航项没有 `role` 属性,则对所有人可见。
|
|
100
|
-
- 如果当前用户未认证,他们只能看到包含 `guest` 角色的项目。
|
|
101
|
-
- 如果当前用户已认证,组件会将其 `user.role` 与每个导航项的 `role` 数组进行比较。只有在匹配的情况下,该项目才会显示。
|
|
102
|
-
- 只有当父导航项至少有一个子项可见时,父导航项本身才可见。
|
|
103
|
-
|
|
104
|
-
使用上面的 `blocklet.yml` 示例:
|
|
105
|
-
- 具有 `guest` 角色的用户将只看到“Home”链接。
|
|
106
|
-
- 具有 `admin` 角色的用户将看到“Home”和“Analytics”。
|
|
107
|
-
- 具有 `owner` 角色的用户将看到所有链接,包括“Settings”下的嵌套链接“Profile”和“Billing”。
|
|
108
|
-
|
|
109
|
-
### 图标
|
|
110
|
-
|
|
111
|
-
导航项的 `icon` 属性应该是一个字符串,对应于 [Iconify](https://icon-sets.iconify.design/) 库中的图标名称(例如,`mdi:home`)。您也可以提供一个指向图像文件的完整 URL。
|
|
112
|
-
|
|
113
|
-
## 自定义
|
|
114
|
-
|
|
115
|
-
虽然 `Dashboard` 被设计为可以与元数据开箱即用,但它也提供了几个属性用于更高级的自定义。
|
|
116
|
-
|
|
117
|
-
### 自定义头部附加组件
|
|
118
|
-
|
|
119
|
-
您可以使用 `headerAddons` 属性修改默认的头部附加组件(例如,主题切换器、区域设置选择器、会话管理器)。通过传递一个函数,您可以添加新元素或重新排列现有元素。
|
|
120
|
-
|
|
121
|
-
```javascript CustomHeader.jsx icon=logos:react
|
|
122
|
-
import Dashboard from '@arcblock/blocklet-ui-react/lib/Dashboard';
|
|
123
|
-
import Button from '@mui/material/Button';
|
|
124
|
-
|
|
125
|
-
function MyCustomButton() {
|
|
126
|
-
return <Button color="inherit" onClick={() => alert('Help!')}>Help</Button>;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export default function CustomDashboard() {
|
|
130
|
-
return (
|
|
131
|
-
<Dashboard
|
|
132
|
-
headerAddons={(existingAddons) => {
|
|
133
|
-
const customAddon = <MyCustomButton key="custom-help" />;
|
|
134
|
-
// 将自定义按钮添加到其他附加组件之前
|
|
135
|
-
return [customAddon, ...existingAddons];
|
|
136
|
-
}}
|
|
137
|
-
>
|
|
138
|
-
<p>带有自定义头部按钮的 Dashboard。</p>
|
|
139
|
-
</Dashboard>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### 以编程方式添加链接
|
|
145
|
-
|
|
146
|
-
`links` 属性允许您通过代码动态添加或修改侧边栏导航链接。这对于依赖于应用程序状态的链接非常有用。
|
|
147
|
-
|
|
148
|
-
```javascript DynamicLinks.jsx icon=logos:react
|
|
149
|
-
import Dashboard from '@arcblock/blocklet-ui-react/lib/Dashboard';
|
|
150
|
-
import Icon from '@arcblock/ux/lib/Icon';
|
|
151
|
-
|
|
152
|
-
const useFeatureFlag = () => {
|
|
153
|
-
// 在实际应用中,这里会检查功能开关服务
|
|
154
|
-
return true;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
export default function DynamicDashboard() {
|
|
158
|
-
const isBetaFeatureEnabled = useFeatureFlag();
|
|
159
|
-
|
|
160
|
-
return (
|
|
161
|
-
<Dashboard
|
|
162
|
-
links={(existingLinks) => {
|
|
163
|
-
if (isBetaFeatureEnabled) {
|
|
164
|
-
const betaLink = {
|
|
165
|
-
id: 'beta-feature',
|
|
166
|
-
title: 'Beta Feature',
|
|
167
|
-
url: '/beta',
|
|
168
|
-
icon: <Icon name="mdi:test-tube" />,
|
|
169
|
-
external: true, // 客户端路由所需
|
|
170
|
-
};
|
|
171
|
-
return [...existingLinks, betaLink];
|
|
172
|
-
}
|
|
173
|
-
return existingLinks;
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
<p>此仪表盘可能包含动态链接。</p>
|
|
177
|
-
</Dashboard>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## 总结
|
|
184
|
-
|
|
185
|
-
`Dashboard` 组件是快速搭建应用程序布局的强大工具。通过利用 blocklet 元数据,它提供了一个结构化、具备角色感知能力的开箱即用的导航系统。有关更基础的布局组件,请参阅 [Header](./components-layout-header.md) 和 [Footer](./components-layout-footer.md) 的文档。
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Footer
|
|
2
|
-
|
|
3
|
-
`Footer` コンポーネントは、アプリケーションに標準化されたレスポンシブなフッターを提供します。blocklet のメタデータを読み取ることで、ブランディング、ナビゲーションリンク、ソーシャルメディアアイコン、著作権情報などのコンテンツを自動的に入力します。このデータ駆動型のアプローチにより、一貫性が確保され、設定が簡素化されます。
|
|
4
|
-
|
|
5
|
-
このコンポーネントはレスポンシブに設計されており、さまざまな画面サイズに合わせてレイアウトを調整します。また、アプリケーションが埋め込みモードで実行されている場合に自身を非表示にするロジックが組み込まれており、統合時にクリーンなユーザーインターフェースを保証します。
|
|
6
|
-
|
|
7
|
-
## 基本的な使用方法
|
|
8
|
-
|
|
9
|
-
アプリケーションにフッターを追加するには、`Footer` コンポーネントをインポートしてレンダリングするだけです。グローバルな `window.blocklet` オブジェクトから自動的にデータを取得するため、基本的な使用には props は必要ありません。
|
|
10
|
-
|
|
11
|
-
```jsx 使用例 icon=logos:react
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { Footer } from '@blocklet/ui-react';
|
|
14
|
-
|
|
15
|
-
export default function App() {
|
|
16
|
-
return (
|
|
17
|
-
<div style={{ minHeight: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
18
|
-
<main style={{ flex: 1 }}>
|
|
19
|
-
{/* ここにアプリケーションのコンテンツを記述します */}
|
|
20
|
-
</main>
|
|
21
|
-
<Footer />
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Props
|
|
28
|
-
|
|
29
|
-
`Footer` コンポーネントは、以下の props を通じてカスタマイズできます。
|
|
30
|
-
|
|
31
|
-
<x-field-group>
|
|
32
|
-
<x-field data-name="meta" data-type="object" data-required="false">
|
|
33
|
-
<x-field-desc markdown>
|
|
34
|
-
blocklet のメタデータを含むオブジェクト。この prop を使用して、デフォルトの `window.blocklet` 設定を上書きしたり、グローバルオブジェクトが利用できない環境でデータを提供したりします。構造は blocklet のメタデータ形式と一致する必要があります。
|
|
35
|
-
</x-field-desc>
|
|
36
|
-
</x-field>
|
|
37
|
-
<x-field data-name="theme" data-type="object" data-required="false">
|
|
38
|
-
<x-field-desc markdown>
|
|
39
|
-
フッターの外観をカスタマイズするためのテーマオブジェクト。このオブジェクトはアプリケーションのデフォルトテーマと深くマージされ、色、フォント、スペーシングなどの特定のスタイルを上書きできます。
|
|
40
|
-
</x-field-desc>
|
|
41
|
-
</x-field>
|
|
42
|
-
</x-field-group>
|
|
43
|
-
|
|
44
|
-
## メタデータの設定
|
|
45
|
-
|
|
46
|
-
`Footer` のコンテンツは、主に blocklet のメタデータファイル (`blocklet.yml`) を通じて設定されます。コンポーネントは、このファイルから特定のフィールドを読み取り、さまざまなセクションをレンダリングします。
|
|
47
|
-
|
|
48
|
-
以下は、フッターのすべてのセクションにデータを入力する `blocklet.yml` 設定の例です。
|
|
49
|
-
|
|
50
|
-
```yaml blocklet.yml
|
|
51
|
-
name: my-app
|
|
52
|
-
title: My App
|
|
53
|
-
description: A detailed description of my application that appears in the footer.
|
|
54
|
-
copyright: 'My Company Inc.'
|
|
55
|
-
|
|
56
|
-
# ナビゲーションリンクはグループに構造化されています
|
|
57
|
-
navigation:
|
|
58
|
-
# メインフッターナビゲーション、グルーピングのために2つのレベルをサポート
|
|
59
|
-
footer:
|
|
60
|
-
- title: 'Products'
|
|
61
|
-
items:
|
|
62
|
-
- title: 'Product A'
|
|
63
|
-
link: '/products/a'
|
|
64
|
-
- title: 'Product B'
|
|
65
|
-
link: '/products/b'
|
|
66
|
-
- title: 'Resources'
|
|
67
|
-
items:
|
|
68
|
-
- title: 'Documentation'
|
|
69
|
-
link: '/docs'
|
|
70
|
-
- title: 'Blog'
|
|
71
|
-
link: '/blog'
|
|
72
|
-
|
|
73
|
-
# ソーシャルメディアリンク
|
|
74
|
-
social:
|
|
75
|
-
- title: 'twitter' # アイコンはタイトルから推測されます(例:'twitter'、'github')
|
|
76
|
-
link: 'https://twitter.com/your-handle'
|
|
77
|
-
- title: 'github'
|
|
78
|
-
icon: 'mdi:github' # Iconify のアイコン名を指定することもできます
|
|
79
|
-
link: 'https://github.com/your-org'
|
|
80
|
-
|
|
81
|
-
# ボトムリンク、通常は法的情報やプライバシー情報用
|
|
82
|
-
bottom:
|
|
83
|
-
- title: 'Privacy Policy'
|
|
84
|
-
link: '/privacy'
|
|
85
|
-
- title: 'Terms of Service'
|
|
86
|
-
link: '/terms'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### データ構造
|
|
90
|
-
|
|
91
|
-
メタデータ内の `navigation` オブジェクトは、フッターに表示されるリンクを定義します。これは `footer`、`social`、`bottom` の3つの異なるセクションに整理されています。
|
|
92
|
-
|
|
93
|
-
<x-field-group>
|
|
94
|
-
<x-field data-name="navigation" data-type="object">
|
|
95
|
-
<x-field-desc markdown>
|
|
96
|
-
アプリケーションのすべてのナビゲーション構造を含みます。
|
|
97
|
-
</x-field-desc>
|
|
98
|
-
<x-field data-name="footer" data-type="array">
|
|
99
|
-
<x-field-desc markdown>
|
|
100
|
-
メインフッターナビゲーションエリアのリンクグループの配列。2階層の階層をサポートします。
|
|
101
|
-
</x-field-desc>
|
|
102
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="ナビゲーショングループのタイトル(例:'Products')。"></x-field>
|
|
103
|
-
<x-field data-name="[].link" data-type="string" data-required="false" data-desc="グループタイトル自体のためのオプションのリンク。"></x-field>
|
|
104
|
-
<x-field data-name="[].items" data-type="array" data-required="false" data-desc="子ナビゲーションリンクの配列。">
|
|
105
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="リンクの表示テキスト。"></x-field>
|
|
106
|
-
<x-field data-name="[].link" data-type="string" data-required="true" data-desc="ナビゲーションリンクのURL。"></x-field>
|
|
107
|
-
</x-field>
|
|
108
|
-
</x-field>
|
|
109
|
-
<x-field data-name="social" data-type="array">
|
|
110
|
-
<x-field-desc markdown>
|
|
111
|
-
ソーシャルメディアプロフィールへのリンクの配列。
|
|
112
|
-
</x-field-desc>
|
|
113
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="ソーシャルメディアプラットフォームの名前。アイコンを推測するために使用されます(例:'twitter')。"></x-field>
|
|
114
|
-
<x-field data-name="[].icon" data-type="string" data-required="false" data-desc="Iconify 文字列(例:`mdi:github`)を使用してアイコンを明示的に指定します。推測されたアイコンを上書きします。"></x-field>
|
|
115
|
-
<x-field data-name="[].link" data-type="string" data-required="true" data-desc="ソーシャルメディアプロフィールへのURL。"></x-field>
|
|
116
|
-
</x-field>
|
|
117
|
-
<x-field data-name="bottom" data-type="array">
|
|
118
|
-
<x-field-desc markdown>
|
|
119
|
-
フッターの最下部に表示されるリンクの配列。通常は法的通知用です。
|
|
120
|
-
</x-field-desc>
|
|
121
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="リンクの表示テキスト(例:'Privacy Policy')。"></x-field>
|
|
122
|
-
<x-field data-name="[].link" data-type="string" data-required="true" data-desc="リンクのURL。"></x-field>
|
|
123
|
-
</x-field>
|
|
124
|
-
</x-field>
|
|
125
|
-
</x-field-group>
|
|
126
|
-
|
|
127
|
-
## レイアウト
|
|
128
|
-
|
|
129
|
-
`Footer` コンポーネントは、提供されたデータに基づいて最も適切なレイアウトを賢く選択します。これにより、さまざまなユースケースでクリーンで機能的な表示が保証されます。
|
|
130
|
-
|
|
131
|
-
- **標準レイアウト**: このレイアウトは、メタデータに `footer` ナビゲーションリンクまたは `social` メディアリンクが定義されている場合に自動的に有効になります。ブランド情報、ソーシャルアイコン、ナビゲーションカラムをエレガントに整理するマルチセクションデザインが特徴です。モバイルデバイスでは、ナビゲーショングループは折りたたみ可能なアコーディオンになり、より良いユーザーエクスペリエンスを提供します。
|
|
132
|
-
|
|
133
|
-
- **プレーンレイアウト**: `footer` または `social` リンクが提供されていない場合、コンポーネントは簡素化された単一行のレイアウトにフォールバックします。これは、「利用規約」や「プライバシーポリシー」などの著作権表示といくつかの必須リンクのみを必要とするアプリケーションに最適です。
|
|
134
|
-
|
|
135
|
-
## テーマ設定
|
|
136
|
-
|
|
137
|
-
`theme` オブジェクトを渡すことで、フッターの外観をカスタマイズできます。このオブジェクトは既存のテーマと深くマージされ、特定のオーバーライドが可能です。
|
|
138
|
-
|
|
139
|
-
```jsx カスタムテーマの例 icon=logos:react
|
|
140
|
-
import { Footer } from '@blocklet/ui-react';
|
|
141
|
-
|
|
142
|
-
const customTheme = {
|
|
143
|
-
palette: {
|
|
144
|
-
background: {
|
|
145
|
-
default: '#2c3e50', // フッター用のより暗い背景
|
|
146
|
-
},
|
|
147
|
-
text: {
|
|
148
|
-
primary: '#ecf0f1',
|
|
149
|
-
secondary: '#bdc3c7',
|
|
150
|
-
},
|
|
151
|
-
divider: '#34495e',
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// ... コンポーネントの render メソッド内
|
|
156
|
-
<Footer theme={customTheme} bordered />;
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## 埋め込みモードでの動作
|
|
160
|
-
|
|
161
|
-
`Footer` コンポーネントは、アプリケーションが埋め込みコンテキストでレンダリングされる際に自動的に非表示にする高階コンポーネント (`withHideWhenEmbed`) でラップされています。この動作は、セッションストレージキー `EMBED_MODE_KEY` によって制御されます。このキーが `1` に設定されている場合、フッターはレンダリングされません。これは、blocklet が別のアプリケーション内で表示される際に、冗長なフッターを防ぐのに役立ちます。
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
blocklet メタデータを通じて設定されるヘッダーコンポーネントに関する情報については、[Header ドキュメント](./components-layout-header.md) を参照してください。
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Footer
|
|
2
|
-
|
|
3
|
-
The `Footer` component provides a standardized, responsive footer for your application. It automatically populates its content—including branding, navigation links, social media icons, and copyright information—by reading your blocklet's metadata. This data-driven approach ensures consistency and simplifies configuration.
|
|
4
|
-
|
|
5
|
-
The component is designed to be responsive, adapting its layout for different screen sizes. It also includes built-in logic to hide itself when the application is running in an embedded mode, ensuring a clean user interface in integrations.
|
|
6
|
-
|
|
7
|
-
## Basic Usage
|
|
8
|
-
|
|
9
|
-
To add a footer to your application, simply import and render the `Footer` component. It requires no props for basic use, as it automatically sources data from the global `window.blocklet` object.
|
|
10
|
-
|
|
11
|
-
```jsx Usage Example icon=logos:react
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { Footer } from '@blocklet/ui-react';
|
|
14
|
-
|
|
15
|
-
export default function App() {
|
|
16
|
-
return (
|
|
17
|
-
<div style={{ minHeight: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
18
|
-
<main style={{ flex: 1 }}>
|
|
19
|
-
{/* Your application content goes here */}
|
|
20
|
-
</main>
|
|
21
|
-
<Footer />
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Props
|
|
28
|
-
|
|
29
|
-
The `Footer` component can be customized through the following props.
|
|
30
|
-
|
|
31
|
-
<x-field-group>
|
|
32
|
-
<x-field data-name="meta" data-type="object" data-required="false">
|
|
33
|
-
<x-field-desc markdown>
|
|
34
|
-
An object containing blocklet metadata. Use this prop to override the default `window.blocklet` configuration or to provide data in environments where the global object is not available. The structure should match the blocklet metadata format.
|
|
35
|
-
</x-field-desc>
|
|
36
|
-
</x-field>
|
|
37
|
-
<x-field data-name="theme" data-type="object" data-required="false">
|
|
38
|
-
<x-field-desc markdown>
|
|
39
|
-
A theme object to customize the footer's appearance. This object is deeply merged with the application's default theme, allowing you to override specific styles like colors, fonts, and spacing.
|
|
40
|
-
</x-field-desc>
|
|
41
|
-
</x-field>
|
|
42
|
-
</x-field-group>
|
|
43
|
-
|
|
44
|
-
## Metadata Configuration
|
|
45
|
-
|
|
46
|
-
The content of the `Footer` is primarily configured through the blocklet's metadata file (`blocklet.yml`). The component reads specific fields from this file to render its different sections.
|
|
47
|
-
|
|
48
|
-
Below is an example of a `blocklet.yml` configuration that populates all sections of the footer.
|
|
49
|
-
|
|
50
|
-
```yaml blocklet.yml
|
|
51
|
-
name: my-app
|
|
52
|
-
title: My App
|
|
53
|
-
description: A detailed description of my application that appears in the footer.
|
|
54
|
-
copyright: 'My Company Inc.'
|
|
55
|
-
|
|
56
|
-
# Navigation links are structured into groups
|
|
57
|
-
navigation:
|
|
58
|
-
# Main footer navigation, supports two levels for grouping
|
|
59
|
-
footer:
|
|
60
|
-
- title: 'Products'
|
|
61
|
-
items:
|
|
62
|
-
- title: 'Product A'
|
|
63
|
-
link: '/products/a'
|
|
64
|
-
- title: 'Product B'
|
|
65
|
-
link: '/products/b'
|
|
66
|
-
- title: 'Resources'
|
|
67
|
-
items:
|
|
68
|
-
- title: 'Documentation'
|
|
69
|
-
link: '/docs'
|
|
70
|
-
- title: 'Blog'
|
|
71
|
-
link: '/blog'
|
|
72
|
-
|
|
73
|
-
# Social media links
|
|
74
|
-
social:
|
|
75
|
-
- title: 'twitter' # Icon is inferred from the title (e.g., 'twitter', 'github')
|
|
76
|
-
link: 'https://twitter.com/your-handle'
|
|
77
|
-
- title: 'github'
|
|
78
|
-
icon: 'mdi:github' # You can also specify an Iconify icon name
|
|
79
|
-
link: 'https://github.com/your-org'
|
|
80
|
-
|
|
81
|
-
# Bottom links, typically for legal and privacy information
|
|
82
|
-
bottom:
|
|
83
|
-
- title: 'Privacy Policy'
|
|
84
|
-
link: '/privacy'
|
|
85
|
-
- title: 'Terms of Service'
|
|
86
|
-
link: '/terms'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Data Structure
|
|
90
|
-
|
|
91
|
-
The `navigation` object in your metadata defines the links displayed in the footer. It is organized into three distinct sections: `footer`, `social`, and `bottom`.
|
|
92
|
-
|
|
93
|
-
<x-field-group>
|
|
94
|
-
<x-field data-name="navigation" data-type="object">
|
|
95
|
-
<x-field-desc markdown>
|
|
96
|
-
Contains all navigation structures for the application.
|
|
97
|
-
</x-field-desc>
|
|
98
|
-
<x-field data-name="footer" data-type="array">
|
|
99
|
-
<x-field-desc markdown>
|
|
100
|
-
An array of link groups for the main footer navigation area. Supports a two-level hierarchy.
|
|
101
|
-
</x-field-desc>
|
|
102
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="The title of the navigation group (e.g., 'Products')."></x-field>
|
|
103
|
-
<x-field data-name="[].link" data-type="string" data-required="false" data-desc="An optional link for the group title itself."></x-field>
|
|
104
|
-
<x-field data-name="[].items" data-type="array" data-required="false" data-desc="An array of child navigation links.">
|
|
105
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="The display text for the link."></x-field>
|
|
106
|
-
<x-field data-name="[].link" data-type="string" data-required="true" data-desc="The URL for the navigation link."></x-field>
|
|
107
|
-
</x-field>
|
|
108
|
-
</x-field>
|
|
109
|
-
<x-field data-name="social" data-type="array">
|
|
110
|
-
<x-field-desc markdown>
|
|
111
|
-
An array of links to social media profiles.
|
|
112
|
-
</x-field-desc>
|
|
113
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="The name of the social media platform, used to infer the icon (e.g., 'twitter')."></x-field>
|
|
114
|
-
<x-field data-name="[].icon" data-type="string" data-required="false" data-desc="Explicitly specify an icon using an Iconify string (e.g., `mdi:github`). Overrides the inferred icon."></x-field>
|
|
115
|
-
<x-field data-name="[].link" data-type="string" data-required="true" data-desc="The URL to the social media profile."></x-field>
|
|
116
|
-
</x-field>
|
|
117
|
-
<x-field data-name="bottom" data-type="array">
|
|
118
|
-
<x-field-desc markdown>
|
|
119
|
-
An array of links displayed at the very bottom of the footer, typically for legal notices.
|
|
120
|
-
</x-field-desc>
|
|
121
|
-
<x-field data-name="[].title" data-type="string" data-required="true" data-desc="The display text for the link (e.g., 'Privacy Policy')."></x-field>
|
|
122
|
-
<x-field data-name="[].link" data-type="string" data-required="true" data-desc="The URL for the link."></x-field>
|
|
123
|
-
</x-field>
|
|
124
|
-
</x-field>
|
|
125
|
-
</x-field-group>
|
|
126
|
-
|
|
127
|
-
## Layouts
|
|
128
|
-
|
|
129
|
-
The `Footer` component intelligently selects the most appropriate layout based on the provided data. This ensures a clean and functional presentation across different use cases.
|
|
130
|
-
|
|
131
|
-
- **Standard Layout**: This layout is automatically activated when `footer` navigation links or `social` media links are defined in your metadata. It features a multi-section design that elegantly organizes the brand information, social icons, and navigation columns. On mobile devices, the navigation groups become collapsible accordions for a better user experience.
|
|
132
|
-
|
|
133
|
-
- **Plain Layout**: If no `footer` or `social` links are provided, the component falls back to a simplified, single-row layout. This is ideal for applications that only require a copyright notice and a few essential links, such as "Terms of Service" or "Privacy Policy".
|
|
134
|
-
|
|
135
|
-
## Theming
|
|
136
|
-
|
|
137
|
-
You can customize the footer's appearance by passing a `theme` object. This object is deeply merged with the existing theme, allowing for targeted overrides.
|
|
138
|
-
|
|
139
|
-
```jsx Custom Theme Example icon=logos:react
|
|
140
|
-
import { Footer } from '@blocklet/ui-react';
|
|
141
|
-
|
|
142
|
-
const customTheme = {
|
|
143
|
-
palette: {
|
|
144
|
-
background: {
|
|
145
|
-
default: '#2c3e50', // A darker background for the footer
|
|
146
|
-
},
|
|
147
|
-
text: {
|
|
148
|
-
primary: '#ecf0f1',
|
|
149
|
-
secondary: '#bdc3c7',
|
|
150
|
-
},
|
|
151
|
-
divider: '#34495e',
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// ... in your component's render method
|
|
156
|
-
<Footer theme={customTheme} bordered />;
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Behavior in Embedded Mode
|
|
160
|
-
|
|
161
|
-
The `Footer` component is wrapped in a higher-order component (`withHideWhenEmbed`) that automatically hides it when the application is rendered in an embedded context. This behavior is controlled by a session storage key, `EMBED_MODE_KEY`. If this key is set to `1`, the footer will not be rendered. This is useful for preventing redundant footers when your blocklet is displayed inside another application.
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
For information on the header component, which is also configured via blocklet metadata, please see the [Header documentation](./components-layout-header.md).
|