@coffic/cosy-ui 0.3.69 → 0.4.5
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/dist/app.css +1 -1
- package/dist/components/base/Alert.astro +3 -3
- package/dist/components/containers/Container.astro +80 -4
- package/dist/components/containers/Main.astro +41 -54
- package/dist/components/data-display/Blog.astro +1 -0
- package/dist/components/data-display/ProductCard.astro +0 -2
- package/dist/components/data-display/Products.astro +0 -2
- package/dist/components/data-display/TeamMember.astro +0 -2
- package/dist/components/data-display/TeamMembers.astro +0 -2
- package/dist/components/display/Banner.astro +0 -1
- package/dist/components/display/Card.astro +0 -1
- package/dist/components/display/CodeBlock.astro +0 -1
- package/dist/components/display/CodeExample.astro +0 -1
- package/dist/components/display/Modal.astro +65 -67
- package/dist/components/layouts/AppLayout.astro +258 -0
- package/dist/components/layouts/BaseLayout.astro +46 -92
- package/dist/components/layouts/DashboardLayout.astro +615 -604
- package/dist/components/layouts/Footer.astro +141 -113
- package/dist/components/layouts/Header.astro +11 -292
- package/dist/components/layouts/Sidebar.astro +54 -31
- package/dist/components/layouts/SidebarNav.astro +1 -11
- package/dist/components/typography/Article.astro +8 -30
- package/dist/index.ts +7 -4
- package/dist/types/article.ts +22 -0
- package/dist/types/footer.ts +119 -22
- package/dist/types/header.ts +70 -0
- package/dist/types/layout.ts +71 -10
- package/dist/types/main.ts +69 -0
- package/dist/types/meta.ts +50 -0
- package/dist/types/sidebar.ts +38 -0
- package/package.json +2 -2
- package/dist/components/layouts/DefaultLayout.astro +0 -170
- package/dist/components/layouts/DocumentationLayout.astro +0 -624
- package/dist/components/layouts/LandingLayout.astro +0 -388
@@ -1,11 +1,11 @@
|
|
1
1
|
---
|
2
2
|
/**
|
3
3
|
* @component Footer
|
4
|
-
*
|
4
|
+
*
|
5
5
|
* @description
|
6
6
|
* Footer 组件用于创建网站的页脚部分,提供版权信息、导航链接和社交媒体链接等内容。
|
7
7
|
* 该组件支持高度自定义,可以根据需要显示或隐藏不同的部分。
|
8
|
-
*
|
8
|
+
*
|
9
9
|
* @design
|
10
10
|
* 设计理念:
|
11
11
|
* 1. 清晰的信息层次 - 通过视觉层次和分组展示不同类别的页脚信息
|
@@ -13,17 +13,17 @@
|
|
13
13
|
* 3. 可定制性 - 支持多种配置选项,适应不同网站的需求
|
14
14
|
* 4. 品牌一致性 - 与网站整体设计风格保持一致
|
15
15
|
* 5. 多语言支持 - 支持多种语言显示,自动检测当前语言环境
|
16
|
-
*
|
16
|
+
*
|
17
17
|
* 视觉特点:
|
18
18
|
* - 分区布局:清晰区分不同类别的信息
|
19
19
|
* - 简洁设计:使用适当的间距和字体大小确保可读性
|
20
20
|
* - 品牌展示:突出显示网站名称和标语
|
21
21
|
* - 社交媒体整合:提供社交媒体链接的展示
|
22
|
-
*
|
22
|
+
*
|
23
23
|
* @usage
|
24
24
|
* 基本用法:
|
25
25
|
* ```astro
|
26
|
-
* <Footer
|
26
|
+
* <Footer
|
27
27
|
* siteName="我的网站"
|
28
28
|
* homeLink="/"
|
29
29
|
* slogan="简单而强大"
|
@@ -32,10 +32,10 @@
|
|
32
32
|
* inspirationalSlogan="构建美好的数字体验"
|
33
33
|
* />
|
34
34
|
* ```
|
35
|
-
*
|
35
|
+
*
|
36
36
|
* 添加社交媒体链接:
|
37
37
|
* ```astro
|
38
|
-
* <Footer
|
38
|
+
* <Footer
|
39
39
|
* siteName="我的网站"
|
40
40
|
* homeLink="/"
|
41
41
|
* slogan="简单而强大"
|
@@ -48,10 +48,10 @@
|
|
48
48
|
* ]}
|
49
49
|
* />
|
50
50
|
* ```
|
51
|
-
*
|
51
|
+
*
|
52
52
|
* 添加产品链接:
|
53
53
|
* ```astro
|
54
|
-
* <Footer
|
54
|
+
* <Footer
|
55
55
|
* siteName="我的网站"
|
56
56
|
* homeLink="/"
|
57
57
|
* slogan="简单而强大"
|
@@ -64,10 +64,10 @@
|
|
64
64
|
* ]}
|
65
65
|
* />
|
66
66
|
* ```
|
67
|
-
*
|
67
|
+
*
|
68
68
|
* 完整示例:
|
69
69
|
* ```astro
|
70
|
-
* <Footer
|
70
|
+
* <Footer
|
71
71
|
* siteName="我的网站"
|
72
72
|
* homeLink="/"
|
73
73
|
* slogan="简单而强大"
|
@@ -89,10 +89,10 @@
|
|
89
89
|
* privacyLink="/privacy"
|
90
90
|
* />
|
91
91
|
* ```
|
92
|
-
*
|
92
|
+
*
|
93
93
|
* 指定语言:
|
94
94
|
* ```astro
|
95
|
-
* <Footer
|
95
|
+
* <Footer
|
96
96
|
* siteName="My Website"
|
97
97
|
* homeLink="/"
|
98
98
|
* slogan="Simple and Powerful"
|
@@ -101,16 +101,16 @@
|
|
101
101
|
* lang="en"
|
102
102
|
* />
|
103
103
|
* ```
|
104
|
-
*
|
104
|
+
*
|
105
105
|
* 启用日志:
|
106
106
|
* ```astro
|
107
|
-
* <Footer
|
107
|
+
* <Footer
|
108
108
|
* siteName="我的网站"
|
109
109
|
* homeLink="/"
|
110
110
|
* enableLogging={true}
|
111
111
|
* />
|
112
112
|
* ```
|
113
|
-
*
|
113
|
+
*
|
114
114
|
* @props
|
115
115
|
* @prop {string} siteName - 网站名称
|
116
116
|
* @prop {string} homeLink - 首页链接
|
@@ -138,7 +138,7 @@
|
|
138
138
|
* @prop {boolean} [debug=false] - 调试模式
|
139
139
|
* @prop {string} [lang] - 语言代码,默认自动检测
|
140
140
|
* @prop {boolean} [enableLogging=false] - 是否启用日志输出
|
141
|
-
*
|
141
|
+
*
|
142
142
|
* @accessibility
|
143
143
|
* - 使用语义化HTML结构,确保屏幕阅读器可以正确解析
|
144
144
|
* - 所有链接都有明确的文本描述
|
@@ -151,23 +151,8 @@ import type { FooterProps } from '../../types/footer';
|
|
151
151
|
import { getCurrentLanguage } from '../../utils/language';
|
152
152
|
import { createTextGetter } from '../../utils/i18n';
|
153
153
|
import NavSection from './NavSection.astro';
|
154
|
-
|
155
|
-
// 导入样式
|
156
154
|
import '../../app.css';
|
157
155
|
|
158
|
-
interface Props extends FooterProps {
|
159
|
-
/**
|
160
|
-
* 语言代码
|
161
|
-
* @default 自动检测
|
162
|
-
*/
|
163
|
-
lang?: string;
|
164
|
-
/**
|
165
|
-
* 是否启用日志输出
|
166
|
-
* @default false
|
167
|
-
*/
|
168
|
-
enableLogging?: boolean;
|
169
|
-
}
|
170
|
-
|
171
156
|
const {
|
172
157
|
siteName,
|
173
158
|
homeLink,
|
@@ -194,7 +179,7 @@ const {
|
|
194
179
|
techStackLink,
|
195
180
|
debug = false,
|
196
181
|
lang: userLang,
|
197
|
-
}
|
182
|
+
} = Astro.props as FooterProps;
|
198
183
|
|
199
184
|
// 获取当前语言
|
200
185
|
const langInfo = getCurrentLanguage(userLang);
|
@@ -207,113 +192,156 @@ const currentYear = new Date().getFullYear();
|
|
207
192
|
const processedSocialLinks = socialLinks.map((url) => processSocialLink(url));
|
208
193
|
|
209
194
|
// 调试模式的样式类
|
210
|
-
const debugClasses = debug
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
195
|
+
const debugClasses = debug
|
196
|
+
? {
|
197
|
+
footer: 'cosy:border-2 cosy:border-blue-500',
|
198
|
+
section: 'cosy:border-2 cosy:border-green-500',
|
199
|
+
nav: 'cosy:border-2 cosy:border-yellow-500',
|
200
|
+
aside: 'cosy:border-2 cosy:border-purple-500',
|
201
|
+
}
|
202
|
+
: {
|
203
|
+
footer: '',
|
204
|
+
section: '',
|
205
|
+
nav: '',
|
206
|
+
aside: '',
|
207
|
+
};
|
221
208
|
---
|
222
209
|
|
223
|
-
<footer
|
224
|
-
|
210
|
+
<footer
|
211
|
+
class:list={[
|
212
|
+
'cosy:footer cosy:z-50 cosy:sm:footer-horizontal cosy:bg-base-200 cosy:text-base-content cosy:p-10',
|
213
|
+
debugClasses.footer,
|
214
|
+
]}>
|
215
|
+
<div
|
216
|
+
class:list={[
|
217
|
+
'cosy:flex cosy:flex-col cosy:md:h-56 cosy:gap-8 cosy:container cosy:mx-auto cosy:items-center cosy:w-full cosy:md:flex-row cosy:md:justify-between',
|
218
|
+
debugClasses.section,
|
219
|
+
]}>
|
225
220
|
{/* 品牌区域 */}
|
226
|
-
<aside class:list={[
|
221
|
+
<aside class:list={['cosy:max-w-xs cosy:text-center', debugClasses.aside]}>
|
227
222
|
<a href={homeLink} class="cosy:flex cosy:items-center cosy:gap-2 cosy:mb-4 cosy:no-underline">
|
228
|
-
{
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
223
|
+
{
|
224
|
+
logo && (
|
225
|
+
<img
|
226
|
+
src={logo.src}
|
227
|
+
alt={logo.alt}
|
228
|
+
class="cosy:w-12 cosy:h-12 cosy:mask cosy:mask-squircle"
|
229
|
+
width="48"
|
230
|
+
height="48"
|
231
|
+
/>
|
232
|
+
)
|
233
|
+
}
|
237
234
|
<div>
|
238
235
|
<h2 class="cosy:font-bold cosy:text-xl">{siteName}</h2>
|
239
236
|
<p class="cosy:text-base-content/70">{slogan}</p>
|
240
237
|
</div>
|
241
238
|
</a>
|
242
|
-
|
239
|
+
|
243
240
|
{/* 社交媒体链接 */}
|
244
|
-
{
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
241
|
+
{
|
242
|
+
processedSocialLinks.length > 0 && (
|
243
|
+
<div class="cosy:flex cosy:justify-center cosy:gap-2 cosy:mt-4">
|
244
|
+
{processedSocialLinks.map((link) => (
|
245
|
+
<a
|
246
|
+
href={link.url}
|
247
|
+
class="cosy:btn cosy:btn-circle cosy:btn-ghost cosy:btn-sm"
|
248
|
+
target="_blank"
|
249
|
+
rel="noopener noreferrer"
|
250
|
+
aria-label={link.name}>
|
251
|
+
<SocialIcon platform={link.platform} />
|
252
|
+
</a>
|
253
|
+
))}
|
254
|
+
</div>
|
255
|
+
)
|
256
|
+
}
|
259
257
|
</aside>
|
260
258
|
|
261
259
|
{/* 导航区域 */}
|
262
|
-
<div
|
260
|
+
<div
|
261
|
+
class:list={[
|
262
|
+
'cosy:flex cosy:h-full cosy:flex-col cosy:justify-center cosy:gap-8 cosy:mx-auto cosy:max-w-xl cosy:text-center cosy:items-center cosy:w-full cosy:md:flex-row cosy:md:justify-between cosy:md:items-start',
|
263
|
+
debugClasses.section,
|
264
|
+
]}>
|
263
265
|
{/* 产品导航 */}
|
264
|
-
{products.length > 0 && (
|
265
|
-
<NavSection title={t('products')} links={products} />
|
266
|
-
)}
|
266
|
+
{products.length > 0 && <NavSection title={t('products')} links={products} />}
|
267
267
|
|
268
268
|
{/* 关于导航 */}
|
269
|
-
{
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
269
|
+
{
|
270
|
+
(aboutLink || contactLink || teamLink || careersLink) && (
|
271
|
+
<NavSection
|
272
|
+
title={t('about')}
|
273
|
+
links={[
|
274
|
+
{ name: t('aboutUs'), href: aboutLink },
|
275
|
+
{ name: t('team'), href: teamLink },
|
276
|
+
{ name: t('careers'), href: careersLink },
|
277
|
+
{ name: t('contactUs'), href: contactLink },
|
278
|
+
].filter((link) => link.href)}
|
279
|
+
/>
|
280
|
+
)
|
281
|
+
}
|
277
282
|
|
278
283
|
{/* 资源导航 */}
|
279
|
-
{
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
284
|
+
{
|
285
|
+
(newsLink ||
|
286
|
+
historyLink ||
|
287
|
+
partnersLink ||
|
288
|
+
blogLink ||
|
289
|
+
faqLink ||
|
290
|
+
mediaLink ||
|
291
|
+
techStackLink) && (
|
292
|
+
<NavSection
|
293
|
+
title={t('resources')}
|
294
|
+
links={[
|
295
|
+
{ name: t('news'), href: newsLink },
|
296
|
+
{ name: t('blog'), href: blogLink },
|
297
|
+
{ name: t('faq'), href: faqLink },
|
298
|
+
{ name: t('history'), href: historyLink },
|
299
|
+
{ name: t('techStack'), href: techStackLink },
|
300
|
+
].filter((link) => link.href)}
|
301
|
+
/>
|
302
|
+
)
|
303
|
+
}
|
288
304
|
|
289
305
|
{/* 法律导航 */}
|
290
|
-
{
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
306
|
+
{
|
307
|
+
(termsLink || privacyLink) && (
|
308
|
+
<NavSection
|
309
|
+
title={t('legal')}
|
310
|
+
links={[
|
311
|
+
{ name: t('terms'), href: termsLink },
|
312
|
+
{ name: t('privacy'), href: privacyLink },
|
313
|
+
].filter((link) => link.href)}
|
314
|
+
/>
|
315
|
+
)
|
316
|
+
}
|
296
317
|
</div>
|
297
318
|
</div>
|
298
319
|
</footer>
|
299
320
|
|
300
321
|
{/* 横幅 */}
|
301
|
-
{
|
302
|
-
|
303
|
-
<
|
304
|
-
|
305
|
-
|
322
|
+
{
|
323
|
+
inspirationalSlogan && (
|
324
|
+
<aside
|
325
|
+
class:list={[
|
326
|
+
'cosy:p-4 cosy:bg-primary cosy:text-primary-content cosy:w-full',
|
327
|
+
debugClasses.aside,
|
328
|
+
]}>
|
329
|
+
<p class="cosy:text-center">{inspirationalSlogan}</p>
|
330
|
+
</aside>
|
331
|
+
)
|
332
|
+
}
|
306
333
|
|
307
334
|
{/* 底部版权信息 */}
|
308
|
-
<div
|
309
|
-
|
335
|
+
<div
|
336
|
+
class:list={[
|
337
|
+
'cosy:footer cosy:footer-center cosy:p-4 cosy:bg-base-300 cosy:text-base-content',
|
338
|
+
debugClasses.footer,
|
339
|
+
]}>
|
340
|
+
<aside class:list={['cosy:items-center cosy:grid-flow-col', debugClasses.aside]}>
|
310
341
|
<p class="cosy:opacity-70 cosy:text-sm">
|
311
|
-
© {currentYear}
|
342
|
+
© {currentYear}
|
343
|
+
{company} - {copyright || t('allRightsReserved')}
|
312
344
|
</p>
|
313
|
-
{icp &&
|
314
|
-
<p class="cosy:opacity-70 cosy:ml-4 cosy:text-sm">
|
315
|
-
{icp}
|
316
|
-
</p>
|
317
|
-
)}
|
345
|
+
{icp && <p class="cosy:opacity-70 cosy:ml-4 cosy:text-sm">{icp}</p>}
|
318
346
|
</aside>
|
319
|
-
</div>
|
347
|
+
</div>
|