@coffic/cosy-ui 0.8.20 → 0.8.22
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/src/assets/iconData.ts +10 -0
- package/dist/src/utils/i18n.ts +52 -50
- package/dist/src-astro/banner/Banner.astro +55 -3
- package/dist/src-astro/banner/index.ts +1 -52
- package/dist/src-astro/button/Button.astro +41 -2
- package/dist/src-astro/code-container/ButtonCodeToggle.astro +55 -0
- package/dist/src-astro/code-container/ButtonCopyCode.astro +74 -0
- package/dist/src-astro/code-container/CodeContainer.astro +14 -289
- package/dist/src-astro/code-container/CodePanel.astro +14 -0
- package/dist/src-astro/code-container/CodeToolbar.astro +100 -0
- package/dist/src-astro/code-container/Description.astro +17 -0
- package/dist/src-astro/code-container/Preview.astro +93 -0
- package/dist/src-astro/footer/Footer.astro +52 -20
- package/dist/src-astro/footer/FooterSection.astro +7 -9
- package/dist/src-astro/grid/index.ts +1 -9
- package/dist/src-astro/heading/index.ts +1 -9
- package/dist/src-astro/hero/Hero.astro +78 -9
- package/dist/src-astro/icons/AppStoreIcon.astro +37 -0
- package/dist/src-astro/icons/AstroIcon.astro +8 -1
- package/dist/src-astro/icons/CodeIcon.astro +22 -0
- package/dist/src-astro/icons/WebsiteIcon.astro +31 -0
- package/dist/src-astro/icons/index.ts +4 -2
- package/dist/src-astro/language-switcher/LanguageSwitcher.astro +6 -2
- package/dist/src-astro/link/Link.astro +50 -3
- package/dist/src-astro/nav-item/index.ts +1 -9
- package/dist/src-astro/products/ProductCard.astro +68 -32
- package/dist/src-astro/types/footer.ts +130 -125
- package/dist/src-vue/iPhone/iPhoneWindow.vue +2 -6
- package/dist/src-vue/utils/i18n.ts +52 -50
- package/package.json +1 -1
- package/dist/src-astro/banner/BannerAllAnimations.astro +0 -10
- package/dist/src-astro/banner/BannerBasic.astro +0 -5
- package/dist/src-astro/banner/BannerCustomStyle.astro +0 -8
- package/dist/src-astro/banner/BannerDanger.astro +0 -5
- package/dist/src-astro/banner/BannerFadeIn.astro +0 -5
- package/dist/src-astro/banner/BannerInfo.astro +0 -5
- package/dist/src-astro/banner/BannerPrimary.astro +0 -5
- package/dist/src-astro/banner/BannerSecondary.astro +0 -5
- package/dist/src-astro/banner/BannerSlideUp.astro +0 -5
- package/dist/src-astro/banner/BannerSuccess.astro +0 -5
- package/dist/src-astro/banner/BannerWarning.astro +0 -5
- package/dist/src-astro/grid/GridBasic.astro +0 -21
- package/dist/src-astro/heading/HeadingBasic.astro +0 -10
- package/dist/src-astro/nav-item/NavItemsBasic.astro +0 -30
@@ -65,6 +65,22 @@
|
|
65
65
|
* />
|
66
66
|
* ```
|
67
67
|
*
|
68
|
+
* 添加友情链接:
|
69
|
+
* ```astro
|
70
|
+
* <Footer
|
71
|
+
* siteName="我的网站"
|
72
|
+
* homeLink="/"
|
73
|
+
* slogan="简单而强大"
|
74
|
+
* company="我的公司"
|
75
|
+
* copyright="保留所有权利"
|
76
|
+
* inspirationalSlogan="构建美好的数字体验"
|
77
|
+
* friendlyLinks={[
|
78
|
+
* { name: "合作伙伴A", href: "https://partner-a.com" },
|
79
|
+
* { name: "合作伙伴B", href: "https://partner-b.com", external: true }
|
80
|
+
* ]}
|
81
|
+
* />
|
82
|
+
* ```
|
83
|
+
*
|
68
84
|
* 完整示例:
|
69
85
|
* ```astro
|
70
86
|
* <Footer
|
@@ -79,6 +95,10 @@
|
|
79
95
|
* { name: "产品A", href: "/products/a" },
|
80
96
|
* { name: "产品B", href: "/products/b" }
|
81
97
|
* ]}
|
98
|
+
* friendlyLinks={[
|
99
|
+
* { name: "合作伙伴A", href: "https://partner-a.com" },
|
100
|
+
* { name: "合作伙伴B", href: "https://partner-b.com", external: true }
|
101
|
+
* ]}
|
82
102
|
* socialLinks={[
|
83
103
|
* "https://github.com/myusername",
|
84
104
|
* "https://twitter.com/myusername"
|
@@ -121,6 +141,7 @@
|
|
121
141
|
* @prop {string} [icp] - ICP备案号(中国网站需要)
|
122
142
|
* @prop {Object} [logo] - 网站Logo对象,包含src和alt属性
|
123
143
|
* @prop {Array<Object>} [products=[]] - 产品链接数组,每个对象包含name、href和可选的external属性
|
144
|
+
* @prop {Array<Object>} [friendlyLinks=[]] - 友情链接数组,每个对象包含name、href和可选的external属性
|
124
145
|
* @prop {string} [aboutLink] - "关于我们"页面链接
|
125
146
|
* @prop {string} [contactLink] - "联系我们"页面链接
|
126
147
|
* @prop {string} [termsLink] - "服务条款"页面链接
|
@@ -151,6 +172,7 @@ import {
|
|
151
172
|
LanguageUtil,
|
152
173
|
type IFooterProps,
|
153
174
|
createTextGetter,
|
175
|
+
Link,
|
154
176
|
} from '../../index-astro';
|
155
177
|
import FooterSection from './FooterSection.astro';
|
156
178
|
import '../../style.ts';
|
@@ -165,6 +187,7 @@ const {
|
|
165
187
|
icp,
|
166
188
|
logo,
|
167
189
|
products = [],
|
190
|
+
friendlyLinks = [],
|
168
191
|
aboutLink,
|
169
192
|
contactLink,
|
170
193
|
termsLink,
|
@@ -220,9 +243,7 @@ const debugClasses = debug
|
|
220
243
|
]}>
|
221
244
|
{/* 品牌区域 */}
|
222
245
|
<aside class:list={['cosy:max-w-xs cosy:text-center', debugClasses.aside]}>
|
223
|
-
<
|
224
|
-
href={homeLink}
|
225
|
-
class="cosy:flex cosy:items-center cosy:gap-2 cosy:mb-4 cosy:no-underline">
|
246
|
+
<Link href={homeLink} align="center" noUnderline block class="cosy:mb-4">
|
226
247
|
{
|
227
248
|
logo && (
|
228
249
|
<img
|
@@ -238,21 +259,25 @@ const debugClasses = debug
|
|
238
259
|
<h2 class="cosy:font-bold cosy:text-xl">{siteName}</h2>
|
239
260
|
<p class="cosy:text-base-content/70">{slogan}</p>
|
240
261
|
</div>
|
241
|
-
</
|
262
|
+
</Link>
|
242
263
|
|
243
264
|
{/* 社交媒体链接 */}
|
244
265
|
{
|
245
266
|
processedSocialLinks.length > 0 && (
|
246
267
|
<div class="cosy:flex cosy:justify-center cosy:gap-2 cosy:mt-4">
|
247
268
|
{processedSocialLinks.map((link) => (
|
248
|
-
<
|
269
|
+
<Link
|
249
270
|
href={link.url}
|
250
|
-
|
251
|
-
|
271
|
+
btn
|
272
|
+
circle
|
273
|
+
ghost
|
274
|
+
size="sm"
|
275
|
+
color="primary"
|
276
|
+
external
|
252
277
|
rel="noopener noreferrer"
|
253
278
|
aria-label={link.name}>
|
254
279
|
<SocialIcon platform={link.platform} />
|
255
|
-
</
|
280
|
+
</Link>
|
256
281
|
))}
|
257
282
|
</div>
|
258
283
|
)
|
@@ -272,16 +297,23 @@ const debugClasses = debug
|
|
272
297
|
)
|
273
298
|
}
|
274
299
|
|
300
|
+
{/* 友情链接导航 */}
|
301
|
+
{
|
302
|
+
friendlyLinks.length > 0 && (
|
303
|
+
<FooterSection title={t('friendlyLinks')} links={friendlyLinks} />
|
304
|
+
)
|
305
|
+
}
|
306
|
+
|
275
307
|
{/* 关于导航 */}
|
276
308
|
{
|
277
309
|
(aboutLink || contactLink || teamLink || careersLink) && (
|
278
310
|
<FooterSection
|
279
311
|
title={t('about')}
|
280
312
|
links={[
|
281
|
-
{ name: t('aboutUs'), href: aboutLink },
|
282
|
-
{ name: t('team'), href: teamLink },
|
283
|
-
{ name: t('careers'), href: careersLink },
|
284
|
-
{ name: t('contactUs'), href: contactLink },
|
313
|
+
{ name: t('aboutUs'), href: aboutLink ?? '' },
|
314
|
+
{ name: t('team'), href: teamLink ?? '' },
|
315
|
+
{ name: t('careers'), href: careersLink ?? '' },
|
316
|
+
{ name: t('contactUs'), href: contactLink ?? '' },
|
285
317
|
].filter((link) => link.href)}
|
286
318
|
/>
|
287
319
|
)
|
@@ -299,11 +331,11 @@ const debugClasses = debug
|
|
299
331
|
<FooterSection
|
300
332
|
title={t('resources')}
|
301
333
|
links={[
|
302
|
-
{ name: t('news'), href: newsLink },
|
303
|
-
{ name: t('blog'), href: blogLink },
|
304
|
-
{ name: t('faq'), href: faqLink },
|
305
|
-
{ name: t('history'), href: historyLink },
|
306
|
-
{ name: t('techStack'), href: techStackLink },
|
334
|
+
{ name: t('news'), href: newsLink ?? '' },
|
335
|
+
{ name: t('blog'), href: blogLink ?? '' },
|
336
|
+
{ name: t('faq'), href: faqLink ?? '' },
|
337
|
+
{ name: t('history'), href: historyLink ?? '' },
|
338
|
+
{ name: t('techStack'), href: techStackLink ?? '' },
|
307
339
|
].filter((link) => link.href)}
|
308
340
|
/>
|
309
341
|
)
|
@@ -315,8 +347,8 @@ const debugClasses = debug
|
|
315
347
|
<FooterSection
|
316
348
|
title={t('legal')}
|
317
349
|
links={[
|
318
|
-
{ name: t('terms'), href: termsLink },
|
319
|
-
{ name: t('privacy'), href: privacyLink },
|
350
|
+
{ name: t('terms'), href: termsLink ?? '' },
|
351
|
+
{ name: t('privacy'), href: privacyLink ?? '' },
|
320
352
|
].filter((link) => link.href)}
|
321
353
|
/>
|
322
354
|
)
|
@@ -337,7 +369,7 @@ const debugClasses = debug
|
|
337
369
|
{/* 底部版权信息 */}
|
338
370
|
<div
|
339
371
|
class:list={[
|
340
|
-
'cosy:footer cosy:footer-center cosy:p-4 cosy:bg-base-300
|
372
|
+
'cosy:footer cosy:footer-center cosy:p-4 cosy:bg-base-300',
|
341
373
|
debugClasses.footer,
|
342
374
|
]}>
|
343
375
|
<aside
|
@@ -6,10 +6,7 @@
|
|
6
6
|
* FooterSection 组件用于在页脚中显示一组链接,通常用于导航、产品列表等。
|
7
7
|
*/
|
8
8
|
|
9
|
-
|
10
|
-
name: string;
|
11
|
-
href?: string;
|
12
|
-
}
|
9
|
+
import { Link, type IProduct } from '../../index-astro';
|
13
10
|
|
14
11
|
interface Props {
|
15
12
|
/**
|
@@ -20,7 +17,7 @@ interface Props {
|
|
20
17
|
/**
|
21
18
|
* 链接列表
|
22
19
|
*/
|
23
|
-
links:
|
20
|
+
links: IProduct[];
|
24
21
|
}
|
25
22
|
|
26
23
|
const { title, links } = Astro.props;
|
@@ -33,12 +30,13 @@ const { title, links } = Astro.props;
|
|
33
30
|
links.map((link) => (
|
34
31
|
<li class="cosy:list-none">
|
35
32
|
{link.href ? (
|
36
|
-
<
|
33
|
+
<Link
|
37
34
|
href={link.href}
|
38
|
-
|
39
|
-
|
35
|
+
size="sm"
|
36
|
+
target={link.external ? '_blank' : '_self'}
|
37
|
+
variant="text">
|
40
38
|
{link.name}
|
41
|
-
</
|
39
|
+
</Link>
|
42
40
|
) : (
|
43
41
|
<span class="cosy:opacity-50">{link.name}</span>
|
44
42
|
)}
|
@@ -1,11 +1,3 @@
|
|
1
1
|
import Grid from './Grid.astro';
|
2
|
-
import GridBasic from './GridBasic.astro';
|
3
|
-
import BasicSourceCode from './GridBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '../../src/utils/component';
|
5
2
|
|
6
|
-
export { Grid
|
7
|
-
|
8
|
-
// 导出示例源代码
|
9
|
-
export const GridExampleCodes = {
|
10
|
-
Basic: extractSimpleExample(BasicSourceCode, 'Grid'),
|
11
|
-
};
|
3
|
+
export { Grid };
|
@@ -1,11 +1,3 @@
|
|
1
1
|
import Heading from './Heading.astro';
|
2
|
-
import HeadingBasic from './HeadingBasic.astro';
|
3
|
-
import BasicSourceCode from './HeadingBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '../../src/utils/component';
|
5
2
|
|
6
|
-
export { Heading
|
7
|
-
|
8
|
-
// 导出示例源代码
|
9
|
-
export const HeadingExampleCodes = {
|
10
|
-
Basic: extractSimpleExample(BasicSourceCode, 'Heading'),
|
11
|
-
};
|
3
|
+
export { Heading };
|
@@ -143,7 +143,7 @@
|
|
143
143
|
* @prop {string} links[].text - 链接按钮的文本
|
144
144
|
* @prop {string} links[].href - 链接按钮的目标地址
|
145
145
|
* @prop {string} links[].variant - 链接按钮的变体,可选值:"primary", "secondary", "accent", "info", "success", "warning", "error"
|
146
|
-
* @prop {string} [background="gradient"] - 背景样式,可选值:"gradient", "plain"
|
146
|
+
* @prop {string} [background="gradient"] - 背景样式,可选值:"gradient", "plain", "gradient-primary", "gradient-secondary", "gradient-accent", "gradient-success", "gradient-warning", "gradient-info", "gradient-sky", "gradient-sunset", "gradient-forest", "gradient-ocean", "gradient-mountain", "gradient-flower", "gradient-watermelon", "gradient-lemon", "gradient-grape", "gradient-blueberry", "gradient-mango", "gradient-kiwi", "gradient-pitaya", "gradient-banana"
|
147
147
|
* @prop {string} [align="center"] - 内容对齐方式,可选值:"center", "left", "right"
|
148
148
|
* @prop {string} [imagePosition="right"] - 图片位置,可选值:"right", "left", "top", "bottom"
|
149
149
|
* @prop {string} [backgroundImage] - 背景图片的URL
|
@@ -157,6 +157,7 @@ import { Button } from '../../index-astro';
|
|
157
157
|
interface Link {
|
158
158
|
text: string;
|
159
159
|
href: string;
|
160
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
160
161
|
variant:
|
161
162
|
| 'primary'
|
162
163
|
| 'secondary'
|
@@ -175,7 +176,29 @@ interface Props {
|
|
175
176
|
alt: string;
|
176
177
|
};
|
177
178
|
links: Link[];
|
178
|
-
background?:
|
179
|
+
background?:
|
180
|
+
| 'gradient'
|
181
|
+
| 'plain'
|
182
|
+
| 'gradient-primary'
|
183
|
+
| 'gradient-secondary'
|
184
|
+
| 'gradient-accent'
|
185
|
+
| 'gradient-success'
|
186
|
+
| 'gradient-warning'
|
187
|
+
| 'gradient-info'
|
188
|
+
| 'gradient-sky'
|
189
|
+
| 'gradient-sunset'
|
190
|
+
| 'gradient-forest'
|
191
|
+
| 'gradient-ocean'
|
192
|
+
| 'gradient-mountain'
|
193
|
+
| 'gradient-flower'
|
194
|
+
| 'gradient-watermelon'
|
195
|
+
| 'gradient-lemon'
|
196
|
+
| 'gradient-grape'
|
197
|
+
| 'gradient-blueberry'
|
198
|
+
| 'gradient-mango'
|
199
|
+
| 'gradient-kiwi'
|
200
|
+
| 'gradient-pitaya'
|
201
|
+
| 'gradient-banana';
|
179
202
|
align?: 'center' | 'left' | 'right';
|
180
203
|
imagePosition?: 'right' | 'left' | 'top' | 'bottom';
|
181
204
|
backgroundImage?: string;
|
@@ -199,6 +222,49 @@ const {
|
|
199
222
|
// 确保不透明度在0-1之间
|
200
223
|
const safeOpacity = Math.max(0, Math.min(1, overlayOpacity));
|
201
224
|
|
225
|
+
// 渐变色背景映射
|
226
|
+
const gradientBgClassMap = {
|
227
|
+
gradient: 'cosy:bg-gradient-to-br cosy:from-primary/10 cosy:to-secondary/20',
|
228
|
+
'gradient-primary':
|
229
|
+
'cosy:bg-gradient-to-br cosy:from-primary-400 cosy:to-primary-700',
|
230
|
+
'gradient-secondary':
|
231
|
+
'cosy:bg-gradient-to-br cosy:from-secondary-400 cosy:to-secondary-700',
|
232
|
+
'gradient-accent':
|
233
|
+
'cosy:bg-gradient-to-br cosy:from-accent-400 cosy:to-accent-700',
|
234
|
+
'gradient-success':
|
235
|
+
'cosy:bg-gradient-to-br cosy:from-success-400 cosy:to-success-700',
|
236
|
+
'gradient-warning':
|
237
|
+
'cosy:bg-gradient-to-br cosy:from-warning-400 cosy:to-warning-700',
|
238
|
+
'gradient-info': 'cosy:bg-gradient-to-br cosy:from-info-400 cosy:to-info-700',
|
239
|
+
'gradient-sky': 'cosy:bg-gradient-to-br cosy:from-sky-400 cosy:to-indigo-500',
|
240
|
+
'gradient-sunset':
|
241
|
+
'cosy:bg-gradient-to-br cosy:from-orange-400 cosy:via-pink-500 cosy:to-red-500',
|
242
|
+
'gradient-forest':
|
243
|
+
'cosy:bg-gradient-to-br cosy:from-green-700 cosy:to-lime-300',
|
244
|
+
'gradient-ocean':
|
245
|
+
'cosy:bg-gradient-to-br cosy:from-cyan-400 cosy:to-blue-700',
|
246
|
+
'gradient-mountain':
|
247
|
+
'cosy:bg-gradient-to-br cosy:from-gray-400 cosy:to-blue-900',
|
248
|
+
'gradient-flower':
|
249
|
+
'cosy:bg-gradient-to-br cosy:from-pink-300 cosy:via-purple-400 cosy:to-fuchsia-500',
|
250
|
+
'gradient-watermelon':
|
251
|
+
'cosy:bg-gradient-to-br cosy:from-green-300 cosy:via-pink-400 cosy:to-red-500',
|
252
|
+
'gradient-lemon':
|
253
|
+
'cosy:bg-gradient-to-br cosy:from-yellow-200 cosy:via-yellow-400 cosy:to-yellow-600',
|
254
|
+
'gradient-grape':
|
255
|
+
'cosy:bg-gradient-to-br cosy:from-purple-400 cosy:via-indigo-500 cosy:to-purple-700',
|
256
|
+
'gradient-blueberry':
|
257
|
+
'cosy:bg-gradient-to-br cosy:from-blue-400 cosy:via-blue-600 cosy:to-indigo-700',
|
258
|
+
'gradient-mango':
|
259
|
+
'cosy:bg-gradient-to-br cosy:from-yellow-300 cosy:via-orange-400 cosy:to-orange-600',
|
260
|
+
'gradient-kiwi':
|
261
|
+
'cosy:bg-gradient-to-br cosy:from-lime-200 cosy:via-green-400 cosy:to-green-700',
|
262
|
+
'gradient-pitaya':
|
263
|
+
'cosy:bg-gradient-to-br cosy:from-pink-200 cosy:via-fuchsia-400 cosy:to-lime-300',
|
264
|
+
'gradient-banana':
|
265
|
+
'cosy:bg-gradient-to-br cosy:from-yellow-100 cosy:via-yellow-300 cosy:to-yellow-500',
|
266
|
+
};
|
267
|
+
|
202
268
|
// 确定容器类
|
203
269
|
const containerClasses = [
|
204
270
|
'cosy:hero',
|
@@ -206,8 +272,9 @@ const containerClasses = [
|
|
206
272
|
'cosy:w-full',
|
207
273
|
'cosy:relative',
|
208
274
|
backgroundImage ? 'cosy:bg-cover cosy:bg-center' : '',
|
209
|
-
!backgroundImage && background
|
210
|
-
?
|
275
|
+
!backgroundImage && background.startsWith('gradient')
|
276
|
+
? gradientBgClassMap[background as keyof typeof gradientBgClassMap] ||
|
277
|
+
gradientBgClassMap['gradient']
|
211
278
|
: '',
|
212
279
|
!backgroundImage && background === 'plain' ? 'cosy:bg-base-100' : '',
|
213
280
|
].join(' ');
|
@@ -329,7 +396,7 @@ const contentOrder = {
|
|
329
396
|
|
330
397
|
<div
|
331
398
|
class={containerClasses}
|
332
|
-
style={backgroundImage ? `background-image: url(${backgroundImage})` :
|
399
|
+
style={backgroundImage ? `background-image: url(${backgroundImage})` : {}}
|
333
400
|
ignore-heading>
|
334
401
|
{
|
335
402
|
backgroundImage && backgroundOverlay !== 'none' && (
|
@@ -353,9 +420,7 @@ const contentOrder = {
|
|
353
420
|
(align === 'left' ? 'cosy:text-left cosy:items-start' : '') +
|
354
421
|
(align === 'right' ? 'cosy:text-right cosy:items-end' : '')}>
|
355
422
|
<h2 class={titleClasses}>{title}</h2>
|
356
|
-
<p class={descriptionClasses}>
|
357
|
-
{description}
|
358
|
-
</p>
|
423
|
+
<p class={descriptionClasses}>{description}</p>
|
359
424
|
|
360
425
|
{
|
361
426
|
Astro.slots.has('app') && (
|
@@ -368,7 +433,11 @@ const contentOrder = {
|
|
368
433
|
<div class={linksContainerClasses}>
|
369
434
|
{
|
370
435
|
links.map((link: Link) => (
|
371
|
-
<Button
|
436
|
+
<Button
|
437
|
+
href={link.href}
|
438
|
+
target={link.target}
|
439
|
+
variant={link.variant}
|
440
|
+
size="lg">
|
372
441
|
{link.text}
|
373
442
|
</Button>
|
374
443
|
))
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
import AstroIcon from './AstroIcon.astro';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* App Store图标组件
|
6
|
+
*/
|
7
|
+
interface Props {
|
8
|
+
/**
|
9
|
+
* 图标的大小
|
10
|
+
* @default "24px"
|
11
|
+
*/
|
12
|
+
size?: string;
|
13
|
+
/**
|
14
|
+
* 图标的颜色
|
15
|
+
* @default "currentColor"
|
16
|
+
*/
|
17
|
+
color?: string;
|
18
|
+
/**
|
19
|
+
* 自定义类名
|
20
|
+
*/
|
21
|
+
class?: string;
|
22
|
+
}
|
23
|
+
|
24
|
+
const {
|
25
|
+
size = '24px',
|
26
|
+
color = 'currentColor',
|
27
|
+
class: className = '',
|
28
|
+
} = Astro.props;
|
29
|
+
---
|
30
|
+
|
31
|
+
<AstroIcon
|
32
|
+
name="appstore"
|
33
|
+
strokeWidth="0.5"
|
34
|
+
size={size}
|
35
|
+
fill={true}
|
36
|
+
class={className}
|
37
|
+
/>
|
@@ -19,6 +19,12 @@ interface Props {
|
|
19
19
|
*/
|
20
20
|
stroke?: string;
|
21
21
|
|
22
|
+
/**
|
23
|
+
* 描边宽度
|
24
|
+
* @default "2"
|
25
|
+
*/
|
26
|
+
strokeWidth?: string;
|
27
|
+
|
22
28
|
/**
|
23
29
|
* 自定义类名
|
24
30
|
*/
|
@@ -35,6 +41,7 @@ const {
|
|
35
41
|
name,
|
36
42
|
size = '24px',
|
37
43
|
stroke = 'currentColor',
|
44
|
+
strokeWidth = '2',
|
38
45
|
class: className = '',
|
39
46
|
fill = false,
|
40
47
|
} = Astro.props;
|
@@ -51,7 +58,7 @@ const viewBox = icon?.viewBox || '0 0 24 24';
|
|
51
58
|
viewBox={viewBox}
|
52
59
|
fill={fill ? 'currentColor' : 'none'}
|
53
60
|
stroke={stroke}
|
54
|
-
stroke-width=
|
61
|
+
stroke-width={strokeWidth}
|
55
62
|
stroke-linecap="round"
|
56
63
|
stroke-linejoin="round"
|
57
64
|
class={className}>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
// @component CodeIcon
|
3
|
+
// @description 代码相关的图标,用于表示代码块、开发等场景
|
4
|
+
import AstroIcon from './AstroIcon.astro';
|
5
|
+
|
6
|
+
interface Props {
|
7
|
+
/** 图标的大小 @default "24px" */
|
8
|
+
size?: string;
|
9
|
+
/** 图标的颜色 @default "currentColor" */
|
10
|
+
color?: string;
|
11
|
+
/** 自定义类名 */
|
12
|
+
class?: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
const {
|
16
|
+
size = '24px',
|
17
|
+
color = 'currentColor',
|
18
|
+
class: className = '',
|
19
|
+
} = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<AstroIcon name="code" size={size} stroke={color} class={className} />
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
import AstroIcon from './AstroIcon.astro';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* 网站图标组件
|
6
|
+
*/
|
7
|
+
interface Props {
|
8
|
+
/**
|
9
|
+
* 图标的大小
|
10
|
+
* @default "24px"
|
11
|
+
*/
|
12
|
+
size?: string;
|
13
|
+
/**
|
14
|
+
* 图标的颜色
|
15
|
+
* @default "currentColor"
|
16
|
+
*/
|
17
|
+
color?: string;
|
18
|
+
/**
|
19
|
+
* 自定义类名
|
20
|
+
*/
|
21
|
+
class?: string;
|
22
|
+
}
|
23
|
+
|
24
|
+
const {
|
25
|
+
size = '24px',
|
26
|
+
color = 'currentColor',
|
27
|
+
class: className = '',
|
28
|
+
} = Astro.props;
|
29
|
+
---
|
30
|
+
|
31
|
+
<AstroIcon name="website" size={size} stroke={color} class={className} />
|
@@ -17,6 +17,8 @@ export { default as CheckCircle } from './CheckCircle.astro';
|
|
17
17
|
export { default as CheckIcon } from './CheckIcon.astro';
|
18
18
|
export { default as ClipboardIcon } from './ClipboardIcon.astro';
|
19
19
|
export { default as CloseIcon } from './CloseIcon.astro';
|
20
|
+
export { default as CodeIcon } from './CodeIcon.astro';
|
21
|
+
export { default as DeleteIcon } from './DeleteIcon.astro';
|
20
22
|
export { default as ErrorIcon } from './ErrorIcon.astro';
|
21
23
|
export { default as GithubIcon } from './GithubIcon.astro';
|
22
24
|
export { default as InfoCircle } from './InfoCircle.astro';
|
@@ -36,7 +38,6 @@ export { default as StarIcon } from './StarIcon.astro';
|
|
36
38
|
export { default as HeartIcon } from './HeartIcon.astro';
|
37
39
|
export { default as SaveIcon } from './SaveIcon.astro';
|
38
40
|
export { default as EditIcon } from './EditIcon.astro';
|
39
|
-
export { default as DeleteIcon } from './DeleteIcon.astro';
|
40
41
|
export { default as ToolsIcon } from './ToolsIcon.astro';
|
41
42
|
export { default as WalletIcon } from './WalletIcon.astro';
|
42
43
|
export { default as ReportIcon } from './ReportIcon.astro';
|
@@ -44,4 +45,5 @@ export { default as SecurityIcon } from './SecurityIcon.astro';
|
|
44
45
|
export { default as UploadIcon } from './UploadIcon.astro';
|
45
46
|
export { default as DownloadIcon } from './DownloadIcon.astro';
|
46
47
|
export { default as LogOut } from './LogOut.astro';
|
47
|
-
|
48
|
+
export { default as AppStoreIcon } from './AppStoreIcon.astro';
|
49
|
+
export { default as WebsiteIcon } from './WebsiteIcon.astro';
|
@@ -32,16 +32,20 @@ import '../../style.ts';
|
|
32
32
|
|
33
33
|
interface Props {
|
34
34
|
languages: string[];
|
35
|
+
/**
|
36
|
+
* 自定义类名
|
37
|
+
*/
|
38
|
+
class?: string;
|
35
39
|
}
|
36
40
|
|
37
|
-
const { languages = ['zh-cn', 'en'] } = Astro.props;
|
41
|
+
const { languages = ['zh-cn', 'en'], class: className = '' } = Astro.props;
|
38
42
|
|
39
43
|
const currentLocale = Astro.currentLocale;
|
40
44
|
const currentLanguageName = LanguageUtil.getLanguageName(currentLocale);
|
41
45
|
---
|
42
46
|
|
43
47
|
<!-- 语言切换按钮 -->
|
44
|
-
<div class=
|
48
|
+
<div class={`cosy:dropdown cosy:dropdown-end ${className}`}>
|
45
49
|
<div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
|
46
50
|
<span class="cosy:mr-1">{currentLanguageName}</span>
|
47
51
|
<ChevronDownIcon size="16px" class="cosy:w-4 cosy:h-4" />
|
@@ -85,6 +85,21 @@ interface Props extends HTMLAttributes<'a'> {
|
|
85
85
|
size?: LinkSize;
|
86
86
|
debug?: boolean;
|
87
87
|
centerText?: boolean;
|
88
|
+
btn?: boolean;
|
89
|
+
circle?: boolean;
|
90
|
+
ghost?: boolean;
|
91
|
+
noUnderline?: boolean;
|
92
|
+
rounded?: boolean;
|
93
|
+
fullWidth?: boolean;
|
94
|
+
color?:
|
95
|
+
| 'primary'
|
96
|
+
| 'secondary'
|
97
|
+
| 'accent'
|
98
|
+
| 'info'
|
99
|
+
| 'success'
|
100
|
+
| 'warning'
|
101
|
+
| 'error';
|
102
|
+
align?: 'left' | 'center' | 'right';
|
88
103
|
}
|
89
104
|
|
90
105
|
const {
|
@@ -98,13 +113,21 @@ const {
|
|
98
113
|
'class:list': classList,
|
99
114
|
debug = false,
|
100
115
|
centerText = false,
|
116
|
+
btn = false,
|
117
|
+
circle = false,
|
118
|
+
ghost = false,
|
119
|
+
noUnderline = true,
|
120
|
+
rounded = false,
|
121
|
+
fullWidth = false,
|
122
|
+
color,
|
123
|
+
align,
|
101
124
|
...rest
|
102
125
|
} = Astro.props;
|
103
126
|
|
104
127
|
// 构建类名
|
105
128
|
const classes = [
|
106
129
|
// 基础链接样式
|
107
|
-
'cosy:items-center cosy:cursor-pointer cosy:
|
130
|
+
'cosy:items-center cosy:cursor-pointer cosy:transition-all cosy:duration-200',
|
108
131
|
|
109
132
|
// 显示方式
|
110
133
|
block ? 'cosy:flex cosy:w-full' : 'cosy:inline-flex',
|
@@ -113,7 +136,7 @@ const classes = [
|
|
113
136
|
variant === 'primary' && 'cosy:text-primary cosy:hover:text-primary-focus',
|
114
137
|
variant === 'secondary' &&
|
115
138
|
'cosy:text-secondary cosy:hover:text-secondary-focus',
|
116
|
-
variant === 'text'
|
139
|
+
variant === 'text',
|
117
140
|
variant === 'cta' &&
|
118
141
|
'cosy:text-accent cosy:hover:text-accent-focus cosy:font-medium',
|
119
142
|
variant === 'ghost' &&
|
@@ -136,11 +159,35 @@ const classes = [
|
|
136
159
|
animation === 'hover-scale' &&
|
137
160
|
'cosy:hover:scale-105 cosy:transition-transform',
|
138
161
|
|
162
|
+
// 新增:按钮风格
|
163
|
+
btn && 'cosy:btn',
|
164
|
+
btn && size === 'sm' && 'cosy:btn-sm',
|
165
|
+
btn && size === 'lg' && 'cosy:btn-lg',
|
166
|
+
btn && ghost && 'cosy:btn-ghost',
|
167
|
+
btn && color && `cosy:btn-${color}`,
|
168
|
+
btn && fullWidth && 'cosy:btn-block',
|
169
|
+
btn && circle && 'cosy:btn-circle',
|
170
|
+
btn && rounded && 'cosy:rounded-full',
|
171
|
+
|
172
|
+
// 非按钮风格下的圆角
|
173
|
+
!btn && rounded && 'cosy:rounded',
|
174
|
+
|
175
|
+
// 非按钮风格下的无下划线
|
176
|
+
!btn && noUnderline && 'cosy:no-underline cosy:hover:no-underline',
|
177
|
+
|
178
|
+
// 宽度100%
|
179
|
+
fullWidth && !btn && 'cosy:w-full',
|
180
|
+
|
181
|
+
// 对齐
|
182
|
+
align === 'center' && 'cosy:justify-center cosy:text-center',
|
183
|
+
align === 'right' && 'cosy:justify-end cosy:text-right',
|
184
|
+
align === 'left' && 'cosy:justify-start cosy:text-left',
|
185
|
+
|
139
186
|
// 自定义类名
|
140
187
|
className,
|
141
188
|
];
|
142
189
|
|
143
|
-
//
|
190
|
+
// 文本居中样式(兼容旧用法)
|
144
191
|
if (centerText) {
|
145
192
|
classes.push('cosy:justify-center cosy:text-center');
|
146
193
|
}
|
@@ -1,11 +1,3 @@
|
|
1
1
|
import NavItems from './NavItems.astro';
|
2
|
-
import NavItemsBasic from './NavItemsBasic.astro';
|
3
|
-
import BasicSourceCode from './NavItemsBasic.astro?raw';
|
4
|
-
import { extractSimpleExample } from '../../src/utils/component';
|
5
2
|
|
6
|
-
export { NavItems
|
7
|
-
|
8
|
-
// 导出示例源代码
|
9
|
-
export const NavItemsExampleCodes = {
|
10
|
-
Basic: extractSimpleExample(BasicSourceCode, 'NavItems'),
|
11
|
-
};
|
3
|
+
export { NavItems };
|