@coffic/cosy-ui 0.1.29 → 0.2.2
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/README.md +43 -22
- package/dist/app.css +1 -0
- package/dist/assets/logo-rounded.png +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/components/base/Alert.astro +186 -0
- package/dist/components/base/Button.astro +103 -0
- package/dist/components/base/Image.astro +291 -0
- package/dist/components/base/Link.astro +131 -0
- package/dist/components/containers/Container.astro +103 -0
- package/dist/components/containers/Main.astro +167 -0
- package/dist/components/containers/Section.astro +145 -0
- package/dist/components/containers/index.ts +3 -0
- package/dist/components/data-display/Blog.astro +195 -0
- package/dist/components/data-display/TeamMember.astro +135 -0
- package/dist/components/data-display/TeamMembers.astro +101 -0
- package/dist/components/display/Banner.astro +57 -0
- package/dist/components/display/Card.astro +135 -0
- package/dist/components/display/CodeBlock.astro +147 -0
- package/dist/components/display/CodeExample.astro +330 -0
- package/dist/components/display/Hero.astro +119 -0
- package/dist/components/display/Modal.astro +115 -0
- package/dist/components/icons/AlertTriangle.astro +35 -0
- package/dist/components/icons/CalendarIcon.astro +38 -0
- package/dist/components/icons/CheckCircle.astro +36 -0
- package/dist/components/icons/CheckIcon.astro +38 -0
- package/dist/components/icons/ClipboardIcon.astro +39 -0
- package/dist/components/icons/CloseIcon.astro +38 -0
- package/dist/components/icons/ErrorIcon.astro +35 -0
- package/dist/components/icons/GithubIcon.astro +31 -0
- package/dist/components/icons/InfoCircle.astro +37 -0
- package/dist/components/icons/InfoIcon.astro +38 -0
- package/dist/components/icons/LinkIcon.astro +39 -0
- package/dist/components/icons/LinkedinIcon.astro +31 -0
- package/dist/components/icons/MenuIcon.astro +41 -0
- package/dist/components/icons/SearchIcon.astro +40 -0
- package/dist/components/icons/SocialIcon.astro +100 -0
- package/dist/components/icons/SuccessIcon.astro +35 -0
- package/dist/components/icons/SunCloudyIcon.astro +45 -0
- package/dist/components/icons/TwitterIcon.astro +31 -0
- package/dist/components/icons/UserIcon.astro +35 -0
- package/dist/components/icons/WarningIcon.astro +38 -0
- package/dist/components/icons/XCircle.astro +37 -0
- package/dist/components/layouts/BaseLayout.astro +144 -0
- package/dist/components/layouts/DashboardLayout.astro +660 -0
- package/dist/components/layouts/DefaultLayout.astro +170 -0
- package/dist/components/layouts/DocumentationLayout.astro +469 -0
- package/dist/components/layouts/Flex.astro +138 -0
- package/dist/components/layouts/Footer.astro +284 -0
- package/dist/components/layouts/Grid.astro +182 -0
- package/dist/components/layouts/Header.astro +114 -0
- package/dist/components/layouts/LandingLayout.astro +388 -0
- package/dist/components/layouts/Stack.astro +149 -0
- package/dist/components/navigation/LanguageSwitcher.astro +81 -0
- package/dist/components/navigation/TableOfContents.astro +352 -0
- package/dist/components/navigation/ThemeSwitcher.astro +89 -0
- package/dist/components/typography/Article.astro +144 -0
- package/dist/components/typography/Heading.astro +205 -0
- package/dist/components/typography/Text.astro +187 -0
- package/dist/index.ts +70 -0
- package/dist/integration.ts +14 -0
- package/dist/style.ts +1 -0
- package/{src → dist}/types/footer.ts +1 -0
- package/dist/utils/theme.ts +55 -0
- package/package.json +67 -59
- package/index.ts +0 -18
- package/src/components/Alert.astro +0 -78
- package/src/components/Article.astro +0 -11
- package/src/components/Banner.astro +0 -49
- package/src/components/Blog.astro +0 -115
- package/src/components/Button.astro +0 -49
- package/src/components/Card.astro +0 -113
- package/src/components/CodeBlock.astro +0 -186
- package/src/components/Footer.astro +0 -148
- package/src/components/Header.astro +0 -305
- package/src/components/Hero.astro +0 -69
- package/src/components/Image.astro +0 -251
- package/src/components/Link.astro +0 -82
- package/src/components/Modal.astro +0 -67
- package/src/components/SocialIcon.astro +0 -36
- package/src/components/TeamMember.astro +0 -68
- package/src/components/TeamMembers.astro +0 -43
- package/src/env.d.ts +0 -0
- /package/{src/components → dist/components/base}/ThemeItem.astro +0 -0
- /package/{src → dist}/utils/social.ts +0 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* DefaultLayout组件
|
4
|
+
*
|
5
|
+
* 包含常用页面结构的默认布局,包括简单的页眉和页脚
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
* ```astro
|
9
|
+
* ---
|
10
|
+
* import DefaultLayout from '../layouts/DefaultLayout.astro';
|
11
|
+
* ---
|
12
|
+
*
|
13
|
+
* <DefaultLayout title="页面标题" description="页面描述">
|
14
|
+
* <h1>页面内容</h1>
|
15
|
+
* <p>这是页面的主要内容</p>
|
16
|
+
* </DefaultLayout>
|
17
|
+
* ```
|
18
|
+
*/
|
19
|
+
|
20
|
+
import BaseLayout from './BaseLayout.astro';
|
21
|
+
import Link from '../base/Link.astro';
|
22
|
+
|
23
|
+
// 导入样式
|
24
|
+
import '../../app.css';
|
25
|
+
|
26
|
+
export interface NavLink {
|
27
|
+
href: string;
|
28
|
+
label: string;
|
29
|
+
}
|
30
|
+
|
31
|
+
export interface Props {
|
32
|
+
/**
|
33
|
+
* 页面标题
|
34
|
+
*/
|
35
|
+
title: string;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* 页面描述
|
39
|
+
*/
|
40
|
+
description?: string;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* 页面关键词
|
44
|
+
*/
|
45
|
+
keywords?: string;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* 是否显示页眉
|
49
|
+
* @default true
|
50
|
+
*/
|
51
|
+
showHeader?: boolean;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* 是否显示页脚
|
55
|
+
* @default true
|
56
|
+
*/
|
57
|
+
showFooter?: boolean;
|
58
|
+
|
59
|
+
/**
|
60
|
+
* 网站名称
|
61
|
+
* @default "网站名称"
|
62
|
+
*/
|
63
|
+
siteName?: string;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* 导航链接
|
67
|
+
*/
|
68
|
+
navLinks?: NavLink[];
|
69
|
+
|
70
|
+
/**
|
71
|
+
* 页面容器类名
|
72
|
+
*/
|
73
|
+
containerClass?: string;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* 自定义头部内容
|
77
|
+
*/
|
78
|
+
head?: astroHTML.JSX.Element;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* 页面类名
|
82
|
+
*/
|
83
|
+
class?: string;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* 类名列表
|
87
|
+
*/
|
88
|
+
'class:list'?: any;
|
89
|
+
}
|
90
|
+
|
91
|
+
const {
|
92
|
+
title,
|
93
|
+
description,
|
94
|
+
keywords,
|
95
|
+
showHeader = true,
|
96
|
+
showFooter = true,
|
97
|
+
siteName = "网站名称",
|
98
|
+
navLinks = [
|
99
|
+
{ href: "/", label: "首页" },
|
100
|
+
{ href: "/about", label: "关于" },
|
101
|
+
{ href: "/contact", label: "联系我们" }
|
102
|
+
],
|
103
|
+
containerClass = "container mx-auto px-4 py-8",
|
104
|
+
head,
|
105
|
+
class: className,
|
106
|
+
'class:list': classList,
|
107
|
+
...rest
|
108
|
+
} = Astro.props;
|
109
|
+
|
110
|
+
const year = new Date().getFullYear();
|
111
|
+
---
|
112
|
+
|
113
|
+
<BaseLayout
|
114
|
+
title={title}
|
115
|
+
description={description}
|
116
|
+
keywords={keywords}
|
117
|
+
head={head}
|
118
|
+
class={className}
|
119
|
+
{...rest}
|
120
|
+
>
|
121
|
+
{showHeader && (
|
122
|
+
<header class="site-header">
|
123
|
+
<div class="container px-4 py-4">
|
124
|
+
<div class="header-content">
|
125
|
+
<div class="logo">
|
126
|
+
<a href="/" class="site-name">{siteName}</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<nav class="main-nav">
|
130
|
+
<ul class="nav-list">
|
131
|
+
{navLinks.map((link: NavLink) => (
|
132
|
+
<li class="nav-item">
|
133
|
+
<Link href={link.href} variant="text">{link.label}</Link>
|
134
|
+
</li>
|
135
|
+
))}
|
136
|
+
</ul>
|
137
|
+
</nav>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
</header>
|
141
|
+
)}
|
142
|
+
|
143
|
+
<main class={containerClass}>
|
144
|
+
<slot />
|
145
|
+
</main>
|
146
|
+
|
147
|
+
{showFooter && (
|
148
|
+
<footer class="site-footer">
|
149
|
+
<div class="container px-4 py-8">
|
150
|
+
<div class="footer-content">
|
151
|
+
<div class="footer-info">
|
152
|
+
<p class="copyright">© {year} {siteName}. 保留所有权利。</p>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<nav class="footer-nav">
|
156
|
+
<ul class="nav-list">
|
157
|
+
{navLinks.map((link: NavLink) => (
|
158
|
+
<li class="nav-item">
|
159
|
+
<Link href={link.href} variant="text" size="sm">{link.label}</Link>
|
160
|
+
</li>
|
161
|
+
))}
|
162
|
+
</ul>
|
163
|
+
</nav>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
</footer>
|
167
|
+
)}
|
168
|
+
|
169
|
+
<slot name="after-footer" />
|
170
|
+
</BaseLayout>
|
@@ -0,0 +1,469 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* DocumentationLayout组件
|
4
|
+
*
|
5
|
+
* 适用于文档页面的布局,包含侧边栏导航和目录
|
6
|
+
*
|
7
|
+
* @example
|
8
|
+
* ```astro
|
9
|
+
* ---
|
10
|
+
* import DocumentationLayout from '../layouts/DocumentationLayout.astro';
|
11
|
+
*
|
12
|
+
* const sidebarItems = [
|
13
|
+
* { title: "入门", items: [
|
14
|
+
* { href: "/docs/getting-started", text: "快速开始" },
|
15
|
+
* { href: "/docs/installation", text: "安装" }
|
16
|
+
* ]},
|
17
|
+
* { title: "组件", items: [
|
18
|
+
* { href: "/docs/components/button", text: "Button 按钮" },
|
19
|
+
* { href: "/docs/components/card", text: "Card 卡片" }
|
20
|
+
* ]}
|
21
|
+
* ];
|
22
|
+
* ---
|
23
|
+
*
|
24
|
+
* <DocumentationLayout
|
25
|
+
* title="文档标题"
|
26
|
+
* description="文档描述"
|
27
|
+
* sidebarItems={sidebarItems}
|
28
|
+
* >
|
29
|
+
* <h1>文档内容</h1>
|
30
|
+
* <p>这是文档的主要内容</p>
|
31
|
+
* </DocumentationLayout>
|
32
|
+
* ```
|
33
|
+
*
|
34
|
+
* 自定义页脚示例:
|
35
|
+
* ```astro
|
36
|
+
* <DocumentationLayout
|
37
|
+
* title="文档标题"
|
38
|
+
* description="文档描述"
|
39
|
+
* sidebarItems={sidebarItems}
|
40
|
+
* footerSlogan="简单而强大的组件库"
|
41
|
+
* footerInspirationalSlogan="让开发更加愉悦"
|
42
|
+
* footerSocialLinks={[
|
43
|
+
* "https://github.com/myorg/myrepo",
|
44
|
+
* "https://twitter.com/myorg"
|
45
|
+
* ]}
|
46
|
+
* footerProducts={[
|
47
|
+
* { name: "组件库", href: "/components" },
|
48
|
+
* { name: "模板", href: "/templates" }
|
49
|
+
* ]}
|
50
|
+
* >
|
51
|
+
* <h1>文档内容</h1>
|
52
|
+
* <p>这是文档的主要内容</p>
|
53
|
+
* </DocumentationLayout>
|
54
|
+
* ```
|
55
|
+
*
|
56
|
+
* 组件支持多种页脚相关的配置参数,可以通过以 `footer` 为前缀的属性来自定义页脚的内容和链接。
|
57
|
+
* 所有这些参数都是可选的,组件会为常用参数提供默认值。
|
58
|
+
*
|
59
|
+
* 调试模式示例:
|
60
|
+
* ```astro
|
61
|
+
* <DocumentationLayout
|
62
|
+
* title="文档标题"
|
63
|
+
* description="文档描述"
|
64
|
+
* sidebarItems={sidebarItems}
|
65
|
+
* debug={true}
|
66
|
+
* >
|
67
|
+
* <h1>文档内容</h1>
|
68
|
+
* <p>这是文档的主要内容</p>
|
69
|
+
* </DocumentationLayout>
|
70
|
+
* ```
|
71
|
+
*/
|
72
|
+
|
73
|
+
// 导入样式
|
74
|
+
import '../../app.css';
|
75
|
+
|
76
|
+
import BaseLayout from './BaseLayout.astro';
|
77
|
+
import TableOfContents from '../navigation/TableOfContents.astro';
|
78
|
+
import Article from '../typography/Article.astro';
|
79
|
+
import Footer from './Footer.astro';
|
80
|
+
import Main from '../containers/Main.astro';
|
81
|
+
import Header from './Header.astro';
|
82
|
+
import DefaultLogo from '../../assets/logo.png';
|
83
|
+
|
84
|
+
export interface SidebarItem {
|
85
|
+
href: string;
|
86
|
+
text: string;
|
87
|
+
items?: SidebarItem[];
|
88
|
+
}
|
89
|
+
|
90
|
+
export interface SidebarSection {
|
91
|
+
title: string;
|
92
|
+
items: SidebarItem[];
|
93
|
+
}
|
94
|
+
|
95
|
+
export interface Props {
|
96
|
+
/**
|
97
|
+
* 页面标题
|
98
|
+
*/
|
99
|
+
title: string;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* 页面描述
|
103
|
+
*/
|
104
|
+
description?: string;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* 页面关键词
|
108
|
+
*/
|
109
|
+
keywords?: string;
|
110
|
+
|
111
|
+
/**
|
112
|
+
* 网站名称
|
113
|
+
* @default "文档中心"
|
114
|
+
*/
|
115
|
+
siteName?: string;
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Logo图片
|
119
|
+
* @default "/logo.svg"
|
120
|
+
*/
|
121
|
+
logo?: ImageMetadata;
|
122
|
+
|
123
|
+
/**
|
124
|
+
* 侧边栏项目
|
125
|
+
*/
|
126
|
+
sidebarItems: SidebarSection[];
|
127
|
+
|
128
|
+
/**
|
129
|
+
* 是否显示目录
|
130
|
+
* @default true
|
131
|
+
*/
|
132
|
+
showTableOfContents?: boolean;
|
133
|
+
|
134
|
+
/**
|
135
|
+
* 是否显示页眉
|
136
|
+
* @default true
|
137
|
+
*/
|
138
|
+
showHeader?: boolean;
|
139
|
+
|
140
|
+
/**
|
141
|
+
* 是否显示页脚
|
142
|
+
* @default true
|
143
|
+
*/
|
144
|
+
showFooter?: boolean;
|
145
|
+
|
146
|
+
/**
|
147
|
+
* 自定义头部内容
|
148
|
+
*/
|
149
|
+
head?: astroHTML.JSX.Element;
|
150
|
+
|
151
|
+
/**
|
152
|
+
* 页面类名
|
153
|
+
*/
|
154
|
+
class?: string;
|
155
|
+
|
156
|
+
/**
|
157
|
+
* 类名列表
|
158
|
+
*/
|
159
|
+
'class:list'?: any;
|
160
|
+
|
161
|
+
/**
|
162
|
+
* 调试模式,显示各个部分的边框
|
163
|
+
* @default false
|
164
|
+
*/
|
165
|
+
debug?: boolean;
|
166
|
+
|
167
|
+
/**
|
168
|
+
* 导航项目
|
169
|
+
*/
|
170
|
+
navItems?: Array<{
|
171
|
+
href: string;
|
172
|
+
label: string;
|
173
|
+
match: (path: string) => boolean;
|
174
|
+
}>;
|
175
|
+
|
176
|
+
/**
|
177
|
+
* 语言列表
|
178
|
+
*/
|
179
|
+
languages?: Array<{ code: string; name: string }>;
|
180
|
+
|
181
|
+
/**
|
182
|
+
* 当前语言
|
183
|
+
*/
|
184
|
+
currentLocale?: string;
|
185
|
+
|
186
|
+
/**
|
187
|
+
* 页脚相关配置
|
188
|
+
*/
|
189
|
+
// Footer 相关参数
|
190
|
+
/**
|
191
|
+
* 页脚标语
|
192
|
+
* @default "优雅、高效的组件库"
|
193
|
+
*/
|
194
|
+
footerSlogan?: string;
|
195
|
+
|
196
|
+
/**
|
197
|
+
* 公司名称
|
198
|
+
* @default 与siteName相同
|
199
|
+
*/
|
200
|
+
footerCompany?: string;
|
201
|
+
|
202
|
+
/**
|
203
|
+
* 版权信息
|
204
|
+
* @default "保留所有权利"
|
205
|
+
*/
|
206
|
+
footerCopyright?: string;
|
207
|
+
|
208
|
+
/**
|
209
|
+
* 页脚横幅标语
|
210
|
+
* @default "构建美好的数字体验"
|
211
|
+
*/
|
212
|
+
footerInspirationalSlogan?: string;
|
213
|
+
|
214
|
+
/**
|
215
|
+
* ICP备案号
|
216
|
+
*/
|
217
|
+
footerIcp?: string;
|
218
|
+
|
219
|
+
/**
|
220
|
+
* 网站Logo
|
221
|
+
*/
|
222
|
+
footerLogo?: { src: string; alt: string };
|
223
|
+
|
224
|
+
/**
|
225
|
+
* 产品链接列表
|
226
|
+
*/
|
227
|
+
footerProducts?: Array<{ name: string; href: string; external?: boolean }>;
|
228
|
+
|
229
|
+
/**
|
230
|
+
* 关于我们链接
|
231
|
+
* @default "/about"
|
232
|
+
*/
|
233
|
+
footerAboutLink?: string;
|
234
|
+
|
235
|
+
/**
|
236
|
+
* 联系我们链接
|
237
|
+
* @default "/contact"
|
238
|
+
*/
|
239
|
+
footerContactLink?: string;
|
240
|
+
|
241
|
+
/**
|
242
|
+
* 服务条款链接
|
243
|
+
*/
|
244
|
+
footerTermsLink?: string;
|
245
|
+
|
246
|
+
/**
|
247
|
+
* 隐私政策链接
|
248
|
+
*/
|
249
|
+
footerPrivacyLink?: string;
|
250
|
+
|
251
|
+
/**
|
252
|
+
* 社交媒体链接列表
|
253
|
+
*/
|
254
|
+
footerSocialLinks?: string[];
|
255
|
+
|
256
|
+
/**
|
257
|
+
* 团队介绍链接
|
258
|
+
*/
|
259
|
+
footerTeamLink?: string;
|
260
|
+
|
261
|
+
/**
|
262
|
+
* 加入我们链接
|
263
|
+
*/
|
264
|
+
footerCareersLink?: string;
|
265
|
+
|
266
|
+
/**
|
267
|
+
* 新闻动态链接
|
268
|
+
*/
|
269
|
+
footerNewsLink?: string;
|
270
|
+
|
271
|
+
/**
|
272
|
+
* 发展历程链接
|
273
|
+
*/
|
274
|
+
footerHistoryLink?: string;
|
275
|
+
|
276
|
+
/**
|
277
|
+
* 合作伙伴链接
|
278
|
+
*/
|
279
|
+
footerPartnersLink?: string;
|
280
|
+
|
281
|
+
/**
|
282
|
+
* 技术博客链接
|
283
|
+
*/
|
284
|
+
footerBlogLink?: string;
|
285
|
+
|
286
|
+
/**
|
287
|
+
* 常见问题链接
|
288
|
+
*/
|
289
|
+
footerFaqLink?: string;
|
290
|
+
|
291
|
+
/**
|
292
|
+
* 媒体报道链接
|
293
|
+
*/
|
294
|
+
footerMediaLink?: string;
|
295
|
+
|
296
|
+
/**
|
297
|
+
* 技术栈链接
|
298
|
+
*/
|
299
|
+
footerTechStackLink?: string;
|
300
|
+
}
|
301
|
+
|
302
|
+
const {
|
303
|
+
title,
|
304
|
+
description,
|
305
|
+
keywords,
|
306
|
+
siteName = "文档中心",
|
307
|
+
logo = DefaultLogo,
|
308
|
+
sidebarItems,
|
309
|
+
showTableOfContents = true,
|
310
|
+
showHeader = true,
|
311
|
+
showFooter = true,
|
312
|
+
head,
|
313
|
+
class: className,
|
314
|
+
'class:list': classList,
|
315
|
+
debug = false,
|
316
|
+
navItems,
|
317
|
+
languages,
|
318
|
+
currentLocale,
|
319
|
+
footerSlogan,
|
320
|
+
footerCompany,
|
321
|
+
footerCopyright,
|
322
|
+
footerInspirationalSlogan,
|
323
|
+
footerIcp,
|
324
|
+
footerLogo,
|
325
|
+
footerProducts,
|
326
|
+
footerAboutLink,
|
327
|
+
footerContactLink,
|
328
|
+
footerTermsLink,
|
329
|
+
footerPrivacyLink,
|
330
|
+
footerSocialLinks,
|
331
|
+
footerTeamLink,
|
332
|
+
footerCareersLink,
|
333
|
+
footerNewsLink,
|
334
|
+
footerHistoryLink,
|
335
|
+
footerPartnersLink,
|
336
|
+
footerBlogLink,
|
337
|
+
footerFaqLink,
|
338
|
+
footerMediaLink,
|
339
|
+
footerTechStackLink,
|
340
|
+
...rest
|
341
|
+
} = Astro.props;
|
342
|
+
|
343
|
+
const currentPath = Astro.url.pathname;
|
344
|
+
---
|
345
|
+
|
346
|
+
<BaseLayout
|
347
|
+
title={title}
|
348
|
+
description={description}
|
349
|
+
keywords={keywords}
|
350
|
+
head={head}
|
351
|
+
class:list={["min-h-screen flex flex-col", { "border border-base-300": debug }]}
|
352
|
+
{...rest}
|
353
|
+
>
|
354
|
+
{showHeader && (
|
355
|
+
<Header
|
356
|
+
logo={logo}
|
357
|
+
navItems={navItems}
|
358
|
+
languages={languages}
|
359
|
+
currentLocale={currentLocale}
|
360
|
+
sticky={true}
|
361
|
+
/>
|
362
|
+
)}
|
363
|
+
|
364
|
+
{debug && (
|
365
|
+
<div class="fixed top-2 right-2 badge badge-warning">
|
366
|
+
调试模式已启用
|
367
|
+
</div>
|
368
|
+
)}
|
369
|
+
|
370
|
+
<div class="flex-1 flex">
|
371
|
+
<aside class="w-64 border-r border-base-300 shrink-0">
|
372
|
+
<nav class="p-4 sticky top-16">
|
373
|
+
{sidebarItems.map((section: SidebarSection) => (
|
374
|
+
<div class="mb-6">
|
375
|
+
<h3 class="font-bold mb-2 text-base-content/70">{section.title}</h3>
|
376
|
+
<ul class="menu menu-sm">
|
377
|
+
{section.items.map((item: SidebarItem) => {
|
378
|
+
const isActive = currentPath === item.href;
|
379
|
+
return (
|
380
|
+
<li>
|
381
|
+
<a
|
382
|
+
href={item.href}
|
383
|
+
class:list={[
|
384
|
+
"hover:bg-base-200",
|
385
|
+
{ "active": isActive }
|
386
|
+
]}
|
387
|
+
>
|
388
|
+
{item.text}
|
389
|
+
</a>
|
390
|
+
{item.items && (
|
391
|
+
<ul class="menu menu-sm pl-4">
|
392
|
+
{item.items.map((subitem: SidebarItem) => {
|
393
|
+
const isSubActive = currentPath === subitem.href;
|
394
|
+
return (
|
395
|
+
<li>
|
396
|
+
<a
|
397
|
+
href={subitem.href}
|
398
|
+
class:list={[
|
399
|
+
"hover:bg-base-200",
|
400
|
+
{ "active": isSubActive }
|
401
|
+
]}
|
402
|
+
>
|
403
|
+
{subitem.text}
|
404
|
+
</a>
|
405
|
+
</li>
|
406
|
+
);
|
407
|
+
})}
|
408
|
+
</ul>
|
409
|
+
)}
|
410
|
+
</li>
|
411
|
+
);
|
412
|
+
})}
|
413
|
+
</ul>
|
414
|
+
</div>
|
415
|
+
))}
|
416
|
+
</nav>
|
417
|
+
</aside>
|
418
|
+
|
419
|
+
<Main
|
420
|
+
class="flex-1 py-8"
|
421
|
+
>
|
422
|
+
<div class="container mx-auto px-4 flex gap-8">
|
423
|
+
<Article
|
424
|
+
class="prose max-w-3xl"
|
425
|
+
>
|
426
|
+
<slot />
|
427
|
+
</Article>
|
428
|
+
|
429
|
+
{showTableOfContents && (
|
430
|
+
<div class="w-64 shrink-0">
|
431
|
+
<div class="sticky top-16">
|
432
|
+
<slot name="toc">
|
433
|
+
<TableOfContents />
|
434
|
+
</slot>
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
)}
|
438
|
+
</div>
|
439
|
+
</Main>
|
440
|
+
</div>
|
441
|
+
|
442
|
+
{showFooter && (
|
443
|
+
<Footer
|
444
|
+
siteName={siteName}
|
445
|
+
homeLink="/"
|
446
|
+
slogan={footerSlogan || "优雅、高效的组件库"}
|
447
|
+
company={footerCompany || siteName}
|
448
|
+
copyright={footerCopyright || "保留所有权利"}
|
449
|
+
inspirationalSlogan={footerInspirationalSlogan || "构建美好的数字体验"}
|
450
|
+
aboutLink={footerAboutLink || "/about"}
|
451
|
+
contactLink={footerContactLink || "/contact"}
|
452
|
+
icp={footerIcp}
|
453
|
+
logo={footerLogo}
|
454
|
+
products={footerProducts}
|
455
|
+
termsLink={footerTermsLink}
|
456
|
+
privacyLink={footerPrivacyLink}
|
457
|
+
socialLinks={footerSocialLinks}
|
458
|
+
teamLink={footerTeamLink}
|
459
|
+
careersLink={footerCareersLink}
|
460
|
+
newsLink={footerNewsLink}
|
461
|
+
historyLink={footerHistoryLink}
|
462
|
+
partnersLink={footerPartnersLink}
|
463
|
+
blogLink={footerBlogLink}
|
464
|
+
faqLink={footerFaqLink}
|
465
|
+
mediaLink={footerMediaLink}
|
466
|
+
techStackLink={footerTechStackLink}
|
467
|
+
/>
|
468
|
+
)}
|
469
|
+
</BaseLayout>
|