@coffic/cosy-ui 0.6.30 → 0.6.34
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/alert/AlertBasicContainer.astro +11 -0
- package/dist/alert/AlertCustomStyleContainer.astro +11 -0
- package/dist/alert/AlertError.astro +6 -0
- package/dist/alert/AlertInfo.astro +6 -0
- package/dist/alert/AlertSuccess.astro +6 -0
- package/dist/alert/AlertTypesContainer.astro +43 -0
- package/dist/alert/AlertWarning.astro +6 -0
- package/dist/alert/AlertWithTitleContainer.astro +11 -0
- package/dist/alert/index.ts +14 -18
- package/dist/app.css +1 -1
- package/dist/assets/iconData.ts +4 -1
- package/dist/{components/display → banner}/Banner.astro +32 -11
- package/dist/banner/BannerAllAnimations.astro +10 -0
- package/dist/banner/BannerBasic.astro +5 -0
- package/dist/banner/BannerCustomStyle.astro +7 -0
- package/dist/banner/BannerDanger.astro +5 -0
- package/dist/banner/BannerFadeIn.astro +5 -0
- package/dist/banner/BannerInfo.astro +5 -0
- package/dist/banner/BannerPrimary.astro +5 -0
- package/dist/banner/BannerSecondary.astro +5 -0
- package/dist/banner/BannerSlideUp.astro +5 -0
- package/dist/banner/BannerSuccess.astro +5 -0
- package/dist/banner/BannerWarning.astro +5 -0
- package/dist/banner/index.ts +41 -0
- package/dist/{components/data-display → blog}/Blog.astro +2 -2
- package/dist/blog/index.ts +1 -0
- package/dist/button/Button.astro +44 -13
- package/dist/button/Button.vue +105 -0
- package/dist/button/ButtonBasic.vue +11 -0
- package/dist/button/ButtonBasicContainer.astro +17 -0
- package/dist/button/ButtonBlock.astro +5 -0
- package/dist/button/ButtonError.astro +5 -0
- package/dist/{vue/Buttons/FeatureButton.vue → button/ButtonFeature.vue} +23 -23
- package/dist/{vue/Buttons/FeatureBasic.vue → button/ButtonFeatureBasic.vue} +2 -2
- package/dist/button/ButtonFeatureContainer.astro +18 -0
- package/dist/{vue/Buttons/FeatureWithTips.vue → button/ButtonFeatureWithTips.vue} +1 -2
- package/dist/button/ButtonGhost.astro +5 -0
- package/dist/button/ButtonIconBoth.astro +9 -0
- package/dist/button/ButtonIconLeft.astro +8 -0
- package/dist/button/ButtonIconRight.astro +8 -0
- package/dist/button/ButtonInfo.astro +5 -0
- package/dist/button/ButtonLink.astro +5 -0
- package/dist/button/ButtonLink.vue +13 -0
- package/dist/button/ButtonLinkContainer.astro +25 -0
- package/dist/button/ButtonLinkExternal.astro +8 -0
- package/dist/button/ButtonNeutral.astro +5 -0
- package/dist/button/ButtonOutline.astro +5 -0
- package/dist/button/ButtonShapeCircle.astro +5 -0
- package/dist/button/ButtonShapeDefault.astro +5 -0
- package/dist/button/ButtonShapeSquare.astro +5 -0
- package/dist/button/ButtonShapesContainer.astro +25 -0
- package/dist/button/ButtonSizes.astro +1 -1
- package/dist/button/ButtonSizes.vue +12 -0
- package/dist/button/ButtonSizesContainer.astro +17 -0
- package/dist/button/ButtonStatesContainer.astro +11 -0
- package/dist/button/ButtonSuccess.astro +5 -0
- package/dist/button/ButtonVariants.astro +14 -0
- package/dist/button/ButtonVariants.vue +16 -0
- package/dist/button/ButtonVariantsContainer.astro +71 -0
- package/dist/button/ButtonWarning.astro +5 -0
- package/dist/button/ButtonWide.astro +5 -0
- package/dist/button/ButtonWidth.astro +8 -0
- package/dist/button/ButtonWidthContainer.astro +19 -0
- package/dist/button/ButtonWithIcons.vue +21 -0
- package/dist/button/ButtonWithIconsContainer.astro +36 -0
- package/dist/button/index_astro.ts +64 -0
- package/dist/button/index_vue.ts +4 -0
- package/dist/card/Card.astro +91 -0
- package/dist/card/CardBasic.astro +5 -0
- package/dist/card/CardCompact.astro +77 -0
- package/dist/card/CardLink.astro +75 -0
- package/dist/card/CardWithImage.astro +39 -0
- package/dist/card/index.ts +7 -0
- package/dist/{components/display → code-block}/CodeBlock.astro +1 -1
- package/dist/code-block/index.ts +1 -0
- package/dist/code-container/CodeContainer.astro +254 -0
- package/dist/code-container/CodeContainerBasic.astro +19 -0
- package/dist/code-container/CodeContainerMultiple.astro +49 -0
- package/dist/code-container/index.ts +14 -0
- package/dist/{components/display → code-example}/CodeExample.astro +10 -11
- package/dist/code-example/index.ts +1 -0
- package/dist/{components/containers → container}/Container.astro +1 -1
- package/dist/container/index.ts +1 -0
- package/dist/env.d.ts +0 -6
- package/dist/footer/Footer.astro +2 -6
- package/dist/header/Header.astro +6 -1
- package/dist/{components/display → hero}/Hero.astro +2 -2
- package/dist/hero/HeroAlignCenter.astro +13 -0
- package/dist/hero/HeroAlignContainer.astro +23 -0
- package/dist/hero/HeroAlignLeft.astro +13 -0
- package/dist/hero/HeroAlignRight.astro +13 -0
- package/dist/hero/HeroBackgroundContainer.astro +18 -0
- package/dist/hero/HeroBackgroundImage.astro +12 -0
- package/dist/hero/HeroBackgroundImageContainer.astro +11 -0
- package/dist/hero/HeroBasic.astro +12 -0
- package/dist/hero/HeroBasicContainer.astro +11 -0
- package/dist/hero/HeroGradientBackground.astro +10 -0
- package/dist/hero/HeroPlainBackground.astro +10 -0
- package/dist/hero/HeroWithButton.astro +11 -0
- package/dist/hero/HeroWithButtonContainer.astro +11 -0
- package/dist/hero/HeroWithImage.astro +16 -0
- package/dist/hero/HeroWithImageContainer.astro +11 -0
- package/dist/hero/index.ts +39 -0
- package/dist/index.ts +1 -1
- package/dist/index_astro.ts +16 -27
- package/dist/index_vue.ts +1 -4
- package/dist/language-switcher/LanguageSwitcher.astro +1 -2
- package/dist/{components/containers → main}/Main.astro +2 -3
- package/dist/main/index.ts +1 -0
- package/dist/{components/display → modal}/Modal.astro +2 -2
- package/dist/modal/index.ts +1 -0
- package/dist/{components/data-display → products}/ProductCard.astro +3 -3
- package/dist/{components/data-display → products}/Products.astro +2 -2
- package/dist/products/index.ts +2 -0
- package/dist/{components/containers → section}/Section.astro +2 -2
- package/dist/section/index.ts +1 -0
- package/dist/sidebar/Sidebar.astro +1 -2
- package/dist/{components/data-display → team-member}/TeamMember.astro +4 -4
- package/dist/team-member/TeamMemberBasic.astro +25 -0
- package/dist/team-member/TeamMemberCustomStyle.astro +26 -0
- package/dist/team-member/TeamMemberGroup.astro +60 -0
- package/dist/team-member/TeamMemberWithSocial.astro +30 -0
- package/dist/{components/data-display → team-member}/TeamMembers.astro +2 -2
- package/dist/team-member/index.ts +23 -0
- package/dist/{theme-item → theme-switcher}/ThemeItem.astro +2 -2
- package/dist/theme-switcher/ThemeSwitcher.astro +10 -20
- package/dist/types/header.ts +32 -9
- package/package.json +5 -1
- package/dist/alert/AlertTypes.astro +0 -17
- package/dist/button/index.ts +0 -23
- package/dist/components/display/Card.astro +0 -162
- package/dist/theme-item/ThemeItemBasic.astro +0 -10
- package/dist/theme-item/index.ts +0 -11
- package/dist/vue/Buttons/LinkBasic.vue +0 -8
- package/dist/vue/Buttons/LinkButton.vue +0 -65
- package/dist/vue/Buttons/Multiple.vue +0 -11
- package/dist/vue/Buttons/index.ts +0 -37
- package/dist/vue/SmartHero/Basic.vue +0 -14
- package/dist/vue/SmartHero/SmartHero.vue +0 -132
- package/dist/vue/SmartHero/WithCustomContent.vue +0 -36
- package/dist/vue/SmartHero/WithImage.vue +0 -19
- package/dist/vue/SmartHero/index.ts +0 -24
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import HeroBasic from './HeroBasic.astro';
|
4
|
+
import HeroBasicSourceCode from './HeroBasic.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[HeroBasicSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<HeroBasic />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import Hero from './Hero.astro';
|
3
|
+
import Button from '../button/Button.astro';
|
4
|
+
---
|
5
|
+
|
6
|
+
<Hero title="带自定义按钮的Hero" description="这是一个带有自定义按钮的Hero组件示例。" links={[]}>
|
7
|
+
<div slot="actions" class="cosy:flex cosy:gap-4">
|
8
|
+
<Button variant="primary">主要操作</Button>
|
9
|
+
<Button variant="secondary">次要操作</Button>
|
10
|
+
</div>
|
11
|
+
</Hero>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import HeroWithButton from './HeroWithButton.astro';
|
4
|
+
import HeroWithButtonSourceCode from './HeroWithButton.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[HeroWithButtonSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<HeroWithButton />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
import Hero from './Hero.astro';
|
3
|
+
import { getExampleImage } from '../index_utils';
|
4
|
+
|
5
|
+
const image = {
|
6
|
+
src: getExampleImage({ width: 400, height: 300, provider: 'picsum' }),
|
7
|
+
alt: '示例图片',
|
8
|
+
};
|
9
|
+
---
|
10
|
+
|
11
|
+
<Hero
|
12
|
+
title="带图片的Hero"
|
13
|
+
description="这是一个带有图片的Hero组件示例。"
|
14
|
+
image={image}
|
15
|
+
links={[{ text: '查看详情', href: '#' }]}
|
16
|
+
/>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import HeroWithImage from './HeroWithImage.astro';
|
4
|
+
import HeroWithImageSourceCode from './HeroWithImage.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[HeroWithImageSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<HeroWithImage />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import Hero from './Hero.astro';
|
2
|
+
import HeroBasic from './HeroBasic.astro';
|
3
|
+
import HeroAlignCenter from './HeroAlignCenter.astro';
|
4
|
+
import HeroAlignLeft from './HeroAlignLeft.astro';
|
5
|
+
import HeroAlignRight from './HeroAlignRight.astro';
|
6
|
+
import HeroWithImage from './HeroWithImage.astro';
|
7
|
+
import HeroWithButton from './HeroWithButton.astro';
|
8
|
+
import HeroPlainBackground from './HeroPlainBackground.astro';
|
9
|
+
import HeroGradientBackground from './HeroGradientBackground.astro';
|
10
|
+
import HeroBackgroundImage from './HeroBackgroundImage.astro';
|
11
|
+
import HeroBasicContainer from './HeroBasicContainer.astro';
|
12
|
+
import HeroAlignContainer from './HeroAlignContainer.astro';
|
13
|
+
import HeroWithImageContainer from './HeroWithImageContainer.astro';
|
14
|
+
import HeroWithButtonContainer from './HeroWithButtonContainer.astro';
|
15
|
+
import HeroBackgroundContainer from './HeroBackgroundContainer.astro';
|
16
|
+
import HeroBackgroundImageContainer from './HeroBackgroundImageContainer.astro';
|
17
|
+
|
18
|
+
export { Hero };
|
19
|
+
|
20
|
+
export const HeroPackage = {
|
21
|
+
Hero,
|
22
|
+
HeroBasic,
|
23
|
+
HeroAlignCenter,
|
24
|
+
HeroAlignLeft,
|
25
|
+
HeroAlignRight,
|
26
|
+
HeroWithImage,
|
27
|
+
HeroWithButton,
|
28
|
+
HeroPlainBackground,
|
29
|
+
HeroGradientBackground,
|
30
|
+
HeroBackgroundImage,
|
31
|
+
HeroContainers: {
|
32
|
+
Basic: HeroBasicContainer,
|
33
|
+
Align: HeroAlignContainer,
|
34
|
+
WithImage: HeroWithImageContainer,
|
35
|
+
WithButton: HeroWithButtonContainer,
|
36
|
+
Background: HeroBackgroundContainer,
|
37
|
+
BackgroundImage: HeroBackgroundImageContainer
|
38
|
+
}
|
39
|
+
};
|
package/dist/index.ts
CHANGED
package/dist/index_astro.ts
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
export * from './button';
|
1
|
+
export * from './button/index_astro';
|
2
|
+
export * from './banner';
|
3
|
+
export * from './blog';
|
4
|
+
export * from './card';
|
5
|
+
export * from './code-container';
|
2
6
|
export * from './article';
|
3
7
|
export * from './link';
|
4
8
|
export * from './image';
|
5
|
-
export * from './theme-item';
|
6
9
|
export * from './alert';
|
7
10
|
export * from './footer';
|
8
11
|
export * from './layout-app';
|
@@ -23,29 +26,19 @@ export * from './heading';
|
|
23
26
|
export * from './stack';
|
24
27
|
export * from './text';
|
25
28
|
export * from './nav-section';
|
26
|
-
export
|
27
|
-
export
|
28
|
-
export
|
29
|
-
export
|
30
|
-
export
|
31
|
-
export
|
32
|
-
export
|
33
|
-
export { default as TeamMember } from './components/data-display/TeamMember.astro';
|
34
|
-
export { default as ProductCard } from './components/data-display/ProductCard.astro';
|
35
|
-
export { default as Products } from './components/data-display/Products.astro';
|
36
|
-
export { default as Blog } from './components/data-display/Blog.astro';
|
29
|
+
export * from './team-member';
|
30
|
+
export * from './code-block';
|
31
|
+
export * from './modal';
|
32
|
+
export * from './hero';
|
33
|
+
export * from './code-example';
|
34
|
+
export * from './products';
|
35
|
+
export * from './blog';
|
37
36
|
export * from './layout-basic/BaseLayout.astro';
|
38
|
-
export
|
39
|
-
|
40
|
-
// Icons
|
37
|
+
export * from './layout-dashboard';
|
41
38
|
export * from './index_icons';
|
42
|
-
|
43
|
-
|
44
|
-
export
|
45
|
-
export { default as Main } from './components/containers/Main.astro';
|
46
|
-
export { default as Section } from './components/containers/Section.astro';
|
47
|
-
|
48
|
-
// Types
|
39
|
+
export * from './container';
|
40
|
+
export * from './main';
|
41
|
+
export * from './section';
|
49
42
|
export * from './types/sidebar';
|
50
43
|
export * from './types/main';
|
51
44
|
export * from './types/article';
|
@@ -58,8 +51,6 @@ export * from './types/product';
|
|
58
51
|
export * from './types/footer';
|
59
52
|
export * from './types/static-path';
|
60
53
|
export type { ImageProvider, ImageOptions } from './utils/image';
|
61
|
-
|
62
|
-
// Entities
|
63
54
|
export * from './entities/BaseDoc';
|
64
55
|
export * from './entities/BlogDoc';
|
65
56
|
export * from './entities/CourseDoc';
|
@@ -68,8 +59,6 @@ export * from './entities/LessonDoc';
|
|
68
59
|
export * from './entities/MetaDoc';
|
69
60
|
export * from './entities/SidebarItem';
|
70
61
|
export * from './entities/Tag';
|
71
|
-
|
72
|
-
// Database
|
73
62
|
export * from './database/BaseDB';
|
74
63
|
export * from './database/BlogDB';
|
75
64
|
export * from './database/CourseDB';
|
package/dist/index_vue.ts
CHANGED
@@ -10,15 +10,12 @@ export * from './vue/BlogList';
|
|
10
10
|
// Counter
|
11
11
|
export { default as VueCounter } from './vue/VueCounter.vue';
|
12
12
|
|
13
|
-
// SmartHero
|
14
|
-
export { SmartHero, SmartHeroExamples, SmartHeroExampleCodes } from './vue/SmartHero';
|
15
|
-
|
16
13
|
// ConfirmDialog
|
17
14
|
export { default as ConfirmDialog } from './vue/ConfirmDialog/ConfirmDialog.vue';
|
18
15
|
export { ConfirmDialogExamples, ConfirmDialogExampleCodes } from './vue/ConfirmDialog';
|
19
16
|
|
20
17
|
// Buttons
|
21
|
-
export * from './
|
18
|
+
export * from './button/index_vue';
|
22
19
|
|
23
20
|
export { default as FeatureCard } from './vue/BannerBox/FeatureCard.vue';
|
24
21
|
|
@@ -47,9 +47,8 @@
|
|
47
47
|
* </Main>
|
48
48
|
* ```
|
49
49
|
*/
|
50
|
-
import '
|
51
|
-
import type
|
52
|
-
import { Article, TableOfContents } from '../../index';
|
50
|
+
import '../style.ts';
|
51
|
+
import { Article, TableOfContents, type IMainContentProps } from '../index';
|
53
52
|
|
54
53
|
export interface Props extends IMainContentProps {}
|
55
54
|
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Main } from './Main.astro';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Modal } from './Modal.astro';
|
@@ -66,9 +66,9 @@
|
|
66
66
|
* ```
|
67
67
|
*/
|
68
68
|
|
69
|
-
import { SocialIcon, Image, Link } from '
|
70
|
-
import '
|
71
|
-
import type { ImageSource } from '
|
69
|
+
import { SocialIcon, Image, Link } from '../index';
|
70
|
+
import '../style.ts';
|
71
|
+
import type { ImageSource } from '../types/image';
|
72
72
|
|
73
73
|
// 自定义图片元数据接口,替代 astro 的 ImageMetadata
|
74
74
|
interface CustomImageMetadata {
|
@@ -19,8 +19,8 @@
|
|
19
19
|
*/
|
20
20
|
|
21
21
|
import type { HTMLAttributes } from 'astro/types';
|
22
|
-
import Container from '
|
23
|
-
import '
|
22
|
+
import Container from '../container/Container.astro';
|
23
|
+
import '../style.ts';
|
24
24
|
|
25
25
|
interface Props extends HTMLAttributes<'section'> {
|
26
26
|
/**
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Section } from './Section.astro';
|
@@ -23,8 +23,7 @@
|
|
23
23
|
|
24
24
|
import '../style.ts';
|
25
25
|
import { isPathMatch } from '../utils/path';
|
26
|
-
import Modal from '../
|
27
|
-
import { MenuIcon, SidebarNav } from '../index';
|
26
|
+
import { MenuIcon, SidebarNav, Modal } from '../index';
|
28
27
|
import type { ISidebarProps } from '../index';
|
29
28
|
|
30
29
|
export interface Props extends ISidebarProps {}
|
@@ -40,9 +40,9 @@
|
|
40
40
|
* ```
|
41
41
|
*/
|
42
42
|
|
43
|
-
import
|
44
|
-
import '
|
45
|
-
import type { ImageSource } from '
|
43
|
+
import '../style.ts';
|
44
|
+
import { SocialIcon, Image, Link } from '../index';
|
45
|
+
import type { ImageSource } from '../types/image';
|
46
46
|
|
47
47
|
interface SocialLink {
|
48
48
|
/**
|
@@ -110,7 +110,7 @@ const { name, role, avatar, bio, socialLinks, class: className = '' } = Astro.pr
|
|
110
110
|
class="cosy:object-cover cosy:aspect-square"
|
111
111
|
/>
|
112
112
|
</figure>
|
113
|
-
<div class="cosy:px-6 cosy:py-4 cosy:card-body">
|
113
|
+
<div class="cosy:px-6 cosy:py-4 cosy:card-body cosy:flex cosy:flex-col cosy:items-center">
|
114
114
|
<h2 class="cosy:mb-1 cosy:font-semibold cosy:text-xl cosy:card-title">{name}</h2>
|
115
115
|
<p class="cosy:mb-3 cosy:text-sm cosy:text-base-content/70">{role}</p>
|
116
116
|
<p class="cosy:mb-4 cosy:text-base">{bio}</p>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component TeamMember.Basic
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 基础的团队成员展示组件示例,展示最简单的成员信息展示方式。
|
7
|
+
*/
|
8
|
+
import '../style.ts';
|
9
|
+
import TeamMember from './TeamMember.astro';
|
10
|
+
import { getExampleImage } from '../utils/image';
|
11
|
+
|
12
|
+
const avatar = getExampleImage({
|
13
|
+
width: 200,
|
14
|
+
height: 200,
|
15
|
+
provider: 'robohash',
|
16
|
+
randomSeed: 'member1',
|
17
|
+
});
|
18
|
+
---
|
19
|
+
|
20
|
+
<TeamMember
|
21
|
+
name="张三"
|
22
|
+
role="产品设计师"
|
23
|
+
avatar={avatar}
|
24
|
+
bio="专注于用户体验设计,拥有5年产品设计经验"
|
25
|
+
/>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component TeamMember.CustomStyle
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 自定义样式的团队成员展示组件示例,展示如何使用class属性自定义样式。
|
7
|
+
*/
|
8
|
+
import '../style.ts';
|
9
|
+
import TeamMember from './TeamMember.astro';
|
10
|
+
import { getExampleImage } from '../utils/image';
|
11
|
+
|
12
|
+
const avatar = getExampleImage({
|
13
|
+
width: 200,
|
14
|
+
height: 200,
|
15
|
+
provider: 'robohash',
|
16
|
+
randomSeed: 'member3',
|
17
|
+
});
|
18
|
+
---
|
19
|
+
|
20
|
+
<TeamMember
|
21
|
+
name="王五"
|
22
|
+
role="市场总监"
|
23
|
+
avatar={avatar}
|
24
|
+
bio="负责产品市场策略和品牌推广,拥有丰富的市场营销经验"
|
25
|
+
class="cosy:bg-gradient-to-r cosy:from-purple-100 cosy:to-pink-100 cosy:shadow-lg cosy:w-72"
|
26
|
+
/>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component TeamMember.Group
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 团队成员组展示组件示例,展示如何组合多个团队成员。
|
7
|
+
*/
|
8
|
+
import '../style.ts';
|
9
|
+
import TeamMember from './TeamMember.astro';
|
10
|
+
import { getExampleImage } from '../utils/image';
|
11
|
+
|
12
|
+
const members = [
|
13
|
+
{
|
14
|
+
name: '张三',
|
15
|
+
title: '产品设计师',
|
16
|
+
avatar: getExampleImage({
|
17
|
+
width: 200,
|
18
|
+
height: 200,
|
19
|
+
provider: 'robohash',
|
20
|
+
randomSeed: 'member1',
|
21
|
+
}),
|
22
|
+
description: '专注于用户体验设计,拥有5年产品设计经验',
|
23
|
+
},
|
24
|
+
{
|
25
|
+
name: '李四',
|
26
|
+
title: '高级开发工程师',
|
27
|
+
avatar: getExampleImage({
|
28
|
+
width: 200,
|
29
|
+
height: 200,
|
30
|
+
provider: 'robohash',
|
31
|
+
randomSeed: 'member2',
|
32
|
+
}),
|
33
|
+
description: '全栈开发专家,热爱开源项目,专注于前端框架和性能优化',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
name: '王五',
|
37
|
+
title: '市场总监',
|
38
|
+
avatar: getExampleImage({
|
39
|
+
width: 200,
|
40
|
+
height: 200,
|
41
|
+
provider: 'robohash',
|
42
|
+
randomSeed: 'member3',
|
43
|
+
}),
|
44
|
+
description: '负责产品市场策略和品牌推广,拥有丰富的市场营销经验',
|
45
|
+
},
|
46
|
+
];
|
47
|
+
---
|
48
|
+
|
49
|
+
<div class="cosy:grid cosy:grid-cols-3 md:cosy:grid-cols-3 cosy:gap-8">
|
50
|
+
{
|
51
|
+
members.map((member) => (
|
52
|
+
<TeamMember
|
53
|
+
name={member.name}
|
54
|
+
role={member.title}
|
55
|
+
avatar={member.avatar}
|
56
|
+
bio={member.description}
|
57
|
+
/>
|
58
|
+
))
|
59
|
+
}
|
60
|
+
</div>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component TeamMember.WithSocial
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 带社交媒体链接的团队成员展示组件示例,展示如何添加社交媒体链接。
|
7
|
+
*/
|
8
|
+
import '../style.ts';
|
9
|
+
import TeamMember from './TeamMember.astro';
|
10
|
+
import { getExampleImage } from '../utils/image';
|
11
|
+
|
12
|
+
const avatar = getExampleImage({
|
13
|
+
width: 200,
|
14
|
+
height: 200,
|
15
|
+
provider: 'robohash',
|
16
|
+
randomSeed: 'member2',
|
17
|
+
});
|
18
|
+
---
|
19
|
+
|
20
|
+
<TeamMember
|
21
|
+
name="李四"
|
22
|
+
role="高级开发工程师"
|
23
|
+
avatar={avatar}
|
24
|
+
bio="全栈开发专家,热爱开源项目,专注于前端框架和性能优化"
|
25
|
+
socialLinks={[
|
26
|
+
{ platform: 'github', url: 'https://github.com' },
|
27
|
+
{ platform: 'twitter', url: 'https://twitter.com' },
|
28
|
+
{ platform: 'linkedin', url: 'https://linkedin.com' },
|
29
|
+
]}
|
30
|
+
/>
|
@@ -30,8 +30,8 @@
|
|
30
30
|
*/
|
31
31
|
|
32
32
|
import TeamMember from './TeamMember.astro';
|
33
|
-
import '
|
34
|
-
import type { ImageSource } from '
|
33
|
+
import '../style.ts';
|
34
|
+
import type { ImageSource } from '../types/image';
|
35
35
|
|
36
36
|
// 自定义图片元数据接口
|
37
37
|
interface ImageMetadata {
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import TeamMember from './TeamMember.astro';
|
2
|
+
import TeamMemberBasic from './TeamMemberBasic.astro';
|
3
|
+
import TeamMemberWithSocial from './TeamMemberWithSocial.astro';
|
4
|
+
import TeamMemberCustomStyle from './TeamMemberCustomStyle.astro';
|
5
|
+
import TeamMemberGroup from './TeamMemberGroup.astro';
|
6
|
+
import TeamMemebrs from './TeamMembers.astro';
|
7
|
+
|
8
|
+
import BasicSourceCode from './TeamMemberBasic.astro?raw';
|
9
|
+
import WithSocialSourceCode from './TeamMemberWithSocial.astro?raw';
|
10
|
+
import CustomStyleSourceCode from './TeamMemberCustomStyle.astro?raw';
|
11
|
+
import GroupSourceCode from './TeamMemberGroup.astro?raw';
|
12
|
+
|
13
|
+
import { extractSimpleExample } from '../utils/component';
|
14
|
+
|
15
|
+
export { TeamMember, TeamMemberBasic, TeamMemberWithSocial, TeamMemberCustomStyle, TeamMemberGroup, TeamMemebrs };
|
16
|
+
|
17
|
+
// Export example codes
|
18
|
+
export const TeamMemberExampleCodes = {
|
19
|
+
Basic: extractSimpleExample(BasicSourceCode, 'TeamMember'),
|
20
|
+
WithSocial: extractSimpleExample(WithSocialSourceCode, 'TeamMember'),
|
21
|
+
CustomStyle: extractSimpleExample(CustomStyleSourceCode, 'TeamMember'),
|
22
|
+
Group: extractSimpleExample(GroupSourceCode, 'TeamMember'),
|
23
|
+
};
|
@@ -39,7 +39,7 @@ const { theme, label, class: className = '' } = Astro.props;
|
|
39
39
|
variant="ghost"
|
40
40
|
size="sm"
|
41
41
|
block
|
42
|
-
class={`cosy:text-left cosy:justify-start ${className}`}
|
43
|
-
data-
|
42
|
+
class={`cosy:text-left cosy:justify-start ${className} cosy:theme-item`}
|
43
|
+
data-theme={theme}>
|
44
44
|
{label}
|
45
45
|
</Button>
|
@@ -25,8 +25,8 @@
|
|
25
25
|
* ```
|
26
26
|
*/
|
27
27
|
|
28
|
-
import
|
29
|
-
import
|
28
|
+
import { SunCloudyIcon } from '../index';
|
29
|
+
import ThemeItem from './ThemeItem.astro';
|
30
30
|
import '../style.ts';
|
31
31
|
|
32
32
|
interface Props {
|
@@ -51,26 +51,15 @@ const themes = [
|
|
51
51
|
];
|
52
52
|
---
|
53
53
|
|
54
|
+
<!-- 主题切换按钮 -->
|
54
55
|
<div class:list={['cosy:dropdown-end cosy:dropdown', className]}>
|
55
|
-
<
|
56
|
-
<SunCloudyIcon class="cosy:w-
|
57
|
-
</
|
56
|
+
<div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
|
57
|
+
<SunCloudyIcon size="16px" class="cosy:w-4 cosy:h-4" />
|
58
|
+
</div>
|
58
59
|
<ul
|
59
|
-
tabindex=
|
60
|
-
class="cosy:bg-
|
61
|
-
{
|
62
|
-
themes.map((theme) => (
|
63
|
-
<li>
|
64
|
-
<button
|
65
|
-
class="cosy:flex cosy:justify-between cosy:items-center cosy:w-full cosy:transition-colors cosy:theme-item"
|
66
|
-
data-theme={theme.id}
|
67
|
-
data-active={false}>
|
68
|
-
<span>{theme.name}</span>
|
69
|
-
<span class="cosy:hidden cosy:text-primary cosy:theme-check">✓</span>
|
70
|
-
</button>
|
71
|
-
</li>
|
72
|
-
))
|
73
|
-
}
|
60
|
+
tabindex={0}
|
61
|
+
class="cosy:dropdown-content cosy:menu cosy:bg-base-100 cosy:dark:bg-neutral-800 cosy:rounded-box cosy:z-[1] cosy:w-56 cosy:p-2 cosy:shadow-lg">
|
62
|
+
{themes.map((theme) => <ThemeItem theme={theme.id} label={theme.name} />)}
|
74
63
|
</ul>
|
75
64
|
</div>
|
76
65
|
|
@@ -103,6 +92,7 @@ const themes = [
|
|
103
92
|
function initThemeSwitcher() {
|
104
93
|
document.querySelectorAll('.cosy\\:theme-item').forEach((item) => {
|
105
94
|
item.addEventListener('click', () => {
|
95
|
+
console.log('Theme item clicked:', item);
|
106
96
|
const theme = item.getAttribute('data-theme');
|
107
97
|
if (theme) {
|
108
98
|
themeManager.setTheme(theme);
|
package/dist/types/header.ts
CHANGED
@@ -34,6 +34,30 @@ export interface IHeaderProps {
|
|
34
34
|
*/
|
35
35
|
navItems?: INavItem[];
|
36
36
|
|
37
|
+
/**
|
38
|
+
* 导航栏位置
|
39
|
+
* @default "start"
|
40
|
+
*/
|
41
|
+
navPosition?: 'start' | 'center' | 'end';
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 水平内边距
|
45
|
+
* @default "md"
|
46
|
+
*/
|
47
|
+
paddingHorizontal?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
48
|
+
|
49
|
+
/**
|
50
|
+
* 垂直内边距
|
51
|
+
* @default "md"
|
52
|
+
*/
|
53
|
+
paddingVertical?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
54
|
+
|
55
|
+
/**
|
56
|
+
* 圆角大小
|
57
|
+
* @default "md"
|
58
|
+
*/
|
59
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
60
|
+
|
37
61
|
/**
|
38
62
|
* 是否显示侧边栏切换按钮
|
39
63
|
* @default false
|
@@ -41,7 +65,13 @@ export interface IHeaderProps {
|
|
41
65
|
showSidebarToggle?: boolean;
|
42
66
|
|
43
67
|
/**
|
44
|
-
*
|
68
|
+
* 是否显示主题切换按钮
|
69
|
+
* @default false
|
70
|
+
*/
|
71
|
+
showThemeSwitcher?: boolean;
|
72
|
+
|
73
|
+
/**
|
74
|
+
* 社交媒体链接列表
|
45
75
|
*/
|
46
76
|
socialLinks?: Array<{
|
47
77
|
name: string;
|
@@ -54,11 +84,4 @@ export interface IHeaderProps {
|
|
54
84
|
* @default true
|
55
85
|
*/
|
56
86
|
sticky?: boolean;
|
57
|
-
|
58
|
-
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
59
|
-
|
60
|
-
paddingHorizontal?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
61
|
-
paddingVertical?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
62
|
-
|
63
|
-
navPosition?: 'start' | 'center' | 'end';
|
64
|
-
}
|
87
|
+
}
|