@coffic/cosy-ui 0.6.42 → 0.7.4
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 → EAlertBasicContainer.astro} +2 -2
- package/dist/alert/{AlertCustomStyleContainer.astro → EAlertCustomStyleContainer.astro} +2 -2
- package/dist/alert/{AlertTypesContainer.astro → EAlertTypesContainer.astro} +8 -8
- package/dist/alert/{AlertWithTitleContainer.astro → EAlertWithTitleContainer.astro} +2 -2
- package/dist/alert/index.ts +12 -12
- package/dist/app.css +1 -1
- package/dist/button/ButtonBasicContainer.astro +1 -7
- package/dist/button/ButtonLinkContainer.astro +1 -7
- package/dist/button/ButtonSizesContainer.astro +1 -7
- package/dist/button/ButtonVariantsContainer.astro +1 -8
- package/dist/button/ButtonWithIconsContainer.astro +2 -13
- package/dist/button/index_astro.ts +1 -3
- package/dist/buttons-vue/index.ts +1 -0
- package/dist/card/Card.astro +59 -10
- package/dist/card/ECardBasic.astro +11 -0
- package/dist/card/ECardBasicContainer.astro +11 -0
- package/dist/card/ECardClickable.astro +13 -0
- package/dist/card/ECardClickableContainer.astro +11 -0
- package/dist/card/ECardCompact.astro +13 -0
- package/dist/card/ECardCompactContainer.astro +11 -0
- package/dist/card/ECardCustomStyle.astro +17 -0
- package/dist/card/ECardCustomStyleContainer.astro +11 -0
- package/dist/card/ECardWithImage.astro +16 -0
- package/dist/card/ECardWithImageContainer.astro +11 -0
- package/dist/card/ECardWithSubtitle.astro +13 -0
- package/dist/card/ECardWithSubtitleContainer.astro +11 -0
- package/dist/card/index.ts +32 -6
- package/dist/code-container/CodeContainer.astro +2 -2
- package/dist/code-container/index.ts +7 -7
- package/dist/contact/Contact.astro +279 -0
- package/dist/contact/EContactBasic.astro +15 -0
- package/dist/contact/EContactBasicContainer.astro +12 -0
- package/dist/contact/EContactCompact.astro +12 -0
- package/dist/contact/EContactCompactContainer.astro +12 -0
- package/dist/contact/EContactCustomStyle.astro +22 -0
- package/dist/contact/EContactCustomStyleContainer.astro +12 -0
- package/dist/contact/EContactSocial.astro +21 -0
- package/dist/contact/EContactSocialContainer.astro +12 -0
- package/dist/contact/EContactWithTitle.astro +18 -0
- package/dist/contact/EContactWithTitleContainer.astro +12 -0
- package/dist/contact/index.ts +21 -0
- package/dist/container/EContainerBasic.astro +13 -0
- package/dist/container/EContainerBasicContainer.astro +11 -0
- package/dist/container/EContainerFlexBetween.astro +16 -0
- package/dist/container/EContainerFlexCenter.astro +23 -0
- package/dist/container/EContainerFlexColumn.astro +16 -0
- package/dist/container/EContainerFlexContainer.astro +34 -0
- package/dist/container/EContainerFlexRow.astro +16 -0
- package/dist/container/EContainerPadding.astro +32 -0
- package/dist/container/EContainerPaddingContainer.astro +11 -0
- package/dist/container/EContainerSizes.astro +36 -0
- package/dist/container/EContainerSizesContainer.astro +11 -0
- package/dist/container/index.ts +16 -1
- package/dist/counter-vue/index.ts +1 -0
- package/dist/footer/{FooterBasic.astro → EFooterBasic.astro} +7 -1
- package/dist/footer/EFooterBasicContainer.astro +11 -0
- package/dist/footer/EFooterComplete.astro +45 -0
- package/dist/footer/EFooterCompleteContainer.astro +11 -0
- package/dist/footer/EFooterFeaturesContainer.astro +40 -0
- package/dist/footer/EFooterWithLogo.astro +23 -0
- package/dist/footer/EFooterWithLogoContainer.astro +11 -0
- package/dist/footer/EFooterWithNavigation.astro +24 -0
- package/dist/footer/EFooterWithNavigationContainer.astro +11 -0
- package/dist/footer/EFooterWithProducts.astro +24 -0
- package/dist/footer/EFooterWithProductsContainer.astro +11 -0
- package/dist/footer/EFooterWithSocial.astro +24 -0
- package/dist/footer/EFooterWithSocialContainer.astro +11 -0
- package/dist/footer/FooterSection.astro +4 -2
- package/dist/footer/index.ts +24 -4
- package/dist/icons/index.ts +3 -0
- package/dist/icons-vue/index.ts +1 -0
- package/dist/index_astro.ts +43 -33
- package/dist/index_vue.ts +12 -23
- package/dist/list-vue/index.ts +1 -0
- package/dist/{vue/MacWindow → mac-window-vue}/MacWindow.vue +1 -1
- package/package.json +3 -10
- package/dist/button/ButtonFeatureContainer.astro +0 -18
- package/dist/button/index_vue.ts +0 -4
- package/dist/vue/SmartLink.vue +0 -17
- package/dist/vue/TagList.vue +0 -23
- /package/dist/alert/{AlertBasic.astro → EAlertBasic.astro} +0 -0
- /package/dist/alert/{AlertCustomStyle.astro → EAlertCustomStyle.astro} +0 -0
- /package/dist/alert/{AlertError.astro → EAlertError.astro} +0 -0
- /package/dist/alert/{AlertInfo.astro → EAlertInfo.astro} +0 -0
- /package/dist/alert/{AlertSuccess.astro → EAlertSuccess.astro} +0 -0
- /package/dist/alert/{AlertWarning.astro → EAlertWarning.astro} +0 -0
- /package/dist/alert/{AlertWithTitle.astro → EAlertWithTitle.astro} +0 -0
- /package/dist/{vue/AlertDialog → alert-dialog-vue}/AlertDialog.vue +0 -0
- /package/dist/{vue/AlertDialog → alert-dialog-vue}/Basic.vue +0 -0
- /package/dist/{vue/AlertDialog → alert-dialog-vue}/Multilang.vue +0 -0
- /package/dist/{vue/AlertDialog → alert-dialog-vue}/index.ts +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/BannerBox.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/DownloadButton.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleBasic.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleCustomBg.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleDisplayModeAlways.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleDisplayModeHover.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleDisplayModeNever.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleImageExport.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/ExampleSizePreset.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/FeatureCard.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/SmartBanner.vue +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/bgStyles.ts +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/index.ts +0 -0
- /package/dist/{vue/BannerBox → banner-box-vue}/sizePresets.ts +0 -0
- /package/dist/{vue/BlogList → blog-vue}/Basic.vue +0 -0
- /package/dist/{vue/BlogList → blog-vue}/BlogList.vue +0 -0
- /package/dist/{vue/BlogList → blog-vue}/Empty.vue +0 -0
- /package/dist/{vue/BlogList → blog-vue}/EmptyEnglish.vue +0 -0
- /package/dist/{vue/BlogList → blog-vue}/English.vue +0 -0
- /package/dist/{vue/BlogList → blog-vue}/index.ts +0 -0
- /package/dist/{button → buttons-vue}/Button.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonBasic.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonFeature.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonFeatureBasic.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonFeatureWithTips.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonLink.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonSizes.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonVariants.vue +0 -0
- /package/dist/{button → buttons-vue}/ButtonWithIcons.vue +0 -0
- /package/dist/code-container/{CodeContainerBasic.astro → ECodeContainerBasic.astro} +0 -0
- /package/dist/code-container/{CodeContainerMultiple.astro → ECodeContainerMultiple.astro} +0 -0
- /package/dist/{vue/ConfirmDialog → confirm-dialog-vue}/Basic.vue +0 -0
- /package/dist/{vue/ConfirmDialog → confirm-dialog-vue}/ConfirmDialog.vue +0 -0
- /package/dist/{vue/ConfirmDialog → confirm-dialog-vue}/CustomButtons.vue +0 -0
- /package/dist/{vue/ConfirmDialog → confirm-dialog-vue}/index.ts +0 -0
- /package/dist/{vue → counter-vue}/VueCounter.vue +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/Basic.vue +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/CustomBackground.vue +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/NoFrame.vue +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/WeatherApp.vue +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/iPhoneWindow.vue +0 -0
- /package/dist/{vue/iPhone → iPhone-vue}/index.ts +0 -0
- /package/dist/{vue/Icons → icons-vue}/AlertTriangleIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/CalendarIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/CheckCircleIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/CheckIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/ChevronDownIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/ClipboardIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/CloseIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/InboxArchiveIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/InfoCircleIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/InfoIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/LinkIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/MenuIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/SearchIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/SettingsIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/UserIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/VueIcon.vue +0 -0
- /package/dist/{vue/Icons → icons-vue}/XCircleIcon.vue +0 -0
- /package/dist/{vue → list-vue}/ListItem.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/Basic.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/CustomHeight.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/WithEvents.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/WithSidebar.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/WithTabs.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/WithToolbar.vue +0 -0
- /package/dist/{vue/MacWindow → mac-window-vue}/index.ts +0 -0
@@ -1,17 +1,11 @@
|
|
1
1
|
---
|
2
2
|
import { CodeContainer } from '../index';
|
3
3
|
import ButtonBasic from './ButtonBasic.astro';
|
4
|
-
import VueButtonBasic from './ButtonBasic.vue';
|
5
4
|
import ButtonBasicSourceCode from './ButtonBasic.astro?raw';
|
6
|
-
import VueButtonBasicSourceCode from './ButtonBasic.vue?raw';
|
7
5
|
---
|
8
6
|
|
9
|
-
<CodeContainer codes={[ButtonBasicSourceCode
|
7
|
+
<CodeContainer codes={[ButtonBasicSourceCode]} titles={['Basic']}>
|
10
8
|
<div id="tab-1">
|
11
9
|
<ButtonBasic />
|
12
10
|
</div>
|
13
|
-
|
14
|
-
<div id="tab-2">
|
15
|
-
<VueButtonBasic client:load />
|
16
|
-
</div>
|
17
11
|
</CodeContainer>
|
@@ -1,16 +1,14 @@
|
|
1
1
|
---
|
2
2
|
import { CodeContainer } from '../index';
|
3
3
|
import ButtonLink from './ButtonLink.astro';
|
4
|
-
import VueButtonLink from './ButtonLink.vue';
|
5
4
|
import ButtonLinkExternal from './ButtonLinkExternal.astro';
|
6
5
|
import ButtonLinkSourceCode from './ButtonLink.astro?raw';
|
7
|
-
import VueButtonLinkSourceCode from './ButtonLink.vue?raw';
|
8
6
|
import ButtonLinkExternalSourceCode from './ButtonLinkExternal.astro?raw';
|
9
7
|
---
|
10
8
|
|
11
9
|
<CodeContainer
|
12
10
|
titles={['基础链接', '外部链接', 'Vue']}
|
13
|
-
codes={[ButtonLinkSourceCode, ButtonLinkExternalSourceCode
|
11
|
+
codes={[ButtonLinkSourceCode, ButtonLinkExternalSourceCode]}>
|
14
12
|
<div id="tab-1">
|
15
13
|
<ButtonLink />
|
16
14
|
</div>
|
@@ -18,8 +16,4 @@ import ButtonLinkExternalSourceCode from './ButtonLinkExternal.astro?raw';
|
|
18
16
|
<div id="tab-2">
|
19
17
|
<ButtonLinkExternal />
|
20
18
|
</div>
|
21
|
-
|
22
|
-
<div id="tab-3">
|
23
|
-
<VueButtonLink client:load />
|
24
|
-
</div>
|
25
19
|
</CodeContainer>
|
@@ -1,17 +1,11 @@
|
|
1
1
|
---
|
2
2
|
import { CodeContainer } from '../index';
|
3
3
|
import ButtonSizes from './ButtonSizes.astro';
|
4
|
-
import VueButtonSizes from './ButtonSizes.vue';
|
5
4
|
import ButtonSizesSourceCode from './ButtonSizes.astro?raw';
|
6
|
-
import VueButtonSizesSourceCode from './ButtonSizes.vue?raw';
|
7
5
|
---
|
8
6
|
|
9
|
-
<CodeContainer codes={[ButtonSizesSourceCode
|
7
|
+
<CodeContainer codes={[ButtonSizesSourceCode]}>
|
10
8
|
<div id="tab-1">
|
11
9
|
<ButtonSizes />
|
12
10
|
</div>
|
13
|
-
|
14
|
-
<div id="tab-2">
|
15
|
-
<VueButtonSizes client:load />
|
16
|
-
</div>
|
17
11
|
</CodeContainer>
|
@@ -8,7 +8,6 @@ import ButtonGhost from './ButtonGhost.astro';
|
|
8
8
|
import ButtonLink from './ButtonLink.astro';
|
9
9
|
import ButtonOutline from './ButtonOutline.astro';
|
10
10
|
import ButtonNeutral from './ButtonNeutral.astro';
|
11
|
-
import VueButtonVariants from './ButtonVariants.vue';
|
12
11
|
import ButtonInfoSourceCode from './ButtonInfo.astro?raw';
|
13
12
|
import ButtonSuccessSourceCode from './ButtonSuccess.astro?raw';
|
14
13
|
import ButtonWarningSourceCode from './ButtonWarning.astro?raw';
|
@@ -17,11 +16,10 @@ import ButtonGhostSourceCode from './ButtonGhost.astro?raw';
|
|
17
16
|
import ButtonLinkSourceCode from './ButtonLink.astro?raw';
|
18
17
|
import ButtonOutlineSourceCode from './ButtonOutline.astro?raw';
|
19
18
|
import ButtonNeutralSourceCode from './ButtonNeutral.astro?raw';
|
20
|
-
import VueButtonVariantsSourceCode from './ButtonVariants.vue?raw';
|
21
19
|
---
|
22
20
|
|
23
21
|
<CodeContainer
|
24
|
-
titles={['Info', 'Success', 'Warning', 'Error', 'Ghost', 'Link', 'Outline', 'Neutral'
|
22
|
+
titles={['Info', 'Success', 'Warning', 'Error', 'Ghost', 'Link', 'Outline', 'Neutral']}
|
25
23
|
codes={[
|
26
24
|
ButtonInfoSourceCode,
|
27
25
|
ButtonSuccessSourceCode,
|
@@ -31,7 +29,6 @@ import VueButtonVariantsSourceCode from './ButtonVariants.vue?raw';
|
|
31
29
|
ButtonLinkSourceCode,
|
32
30
|
ButtonOutlineSourceCode,
|
33
31
|
ButtonNeutralSourceCode,
|
34
|
-
VueButtonVariantsSourceCode,
|
35
32
|
]}>
|
36
33
|
<div id="tab-1">
|
37
34
|
<ButtonInfo />
|
@@ -64,8 +61,4 @@ import VueButtonVariantsSourceCode from './ButtonVariants.vue?raw';
|
|
64
61
|
<div id="tab-8">
|
65
62
|
<ButtonNeutral />
|
66
63
|
</div>
|
67
|
-
|
68
|
-
<div id="tab-9">
|
69
|
-
<VueButtonVariants client:load />
|
70
|
-
</div>
|
71
64
|
</CodeContainer>
|
@@ -3,21 +3,14 @@ import { CodeContainer } from '../index';
|
|
3
3
|
import ButtonIconLeft from './ButtonIconLeft.astro';
|
4
4
|
import ButtonIconRight from './ButtonIconRight.astro';
|
5
5
|
import ButtonIconBoth from './ButtonIconBoth.astro';
|
6
|
-
import VueButtonWithIcons from './ButtonWithIcons.vue';
|
7
6
|
import ButtonIconLeftSourceCode from './ButtonIconLeft.astro?raw';
|
8
7
|
import ButtonIconRightSourceCode from './ButtonIconRight.astro?raw';
|
9
8
|
import ButtonIconBothSourceCode from './ButtonIconBoth.astro?raw';
|
10
|
-
import VueButtonWithIconsSourceCode from './ButtonWithIcons.vue?raw';
|
11
9
|
---
|
12
10
|
|
13
11
|
<CodeContainer
|
14
|
-
titles={['左侧图标', '右侧图标', '两侧图标'
|
15
|
-
codes={[
|
16
|
-
ButtonIconLeftSourceCode,
|
17
|
-
ButtonIconRightSourceCode,
|
18
|
-
ButtonIconBothSourceCode,
|
19
|
-
VueButtonWithIconsSourceCode,
|
20
|
-
]}>
|
12
|
+
titles={['左侧图标', '右侧图标', '两侧图标']}
|
13
|
+
codes={[ButtonIconLeftSourceCode, ButtonIconRightSourceCode, ButtonIconBothSourceCode]}>
|
21
14
|
<div id="tab-1">
|
22
15
|
<ButtonIconLeft />
|
23
16
|
</div>
|
@@ -29,8 +22,4 @@ import VueButtonWithIconsSourceCode from './ButtonWithIcons.vue?raw';
|
|
29
22
|
<div id="tab-3">
|
30
23
|
<ButtonIconBoth />
|
31
24
|
</div>
|
32
|
-
|
33
|
-
<div id="tab-4">
|
34
|
-
<VueButtonWithIcons client:load />
|
35
|
-
</div>
|
36
25
|
</CodeContainer>
|
@@ -24,7 +24,6 @@ import ButtonLink from './ButtonLink.astro';
|
|
24
24
|
import ButtonLinkExternal from './ButtonLinkExternal.astro';
|
25
25
|
import ButtonOutline from './ButtonOutline.astro';
|
26
26
|
import ButtonNeutral from './ButtonNeutral.astro';
|
27
|
-
import ButtonFeatureContainer from './ButtonFeatureContainer.astro';
|
28
27
|
|
29
28
|
export {
|
30
29
|
Button
|
@@ -59,6 +58,5 @@ export const ButtonPackage = {
|
|
59
58
|
Width: ButtonWidthContainer,
|
60
59
|
Variants: ButtonVariantsContainer,
|
61
60
|
Link: ButtonLinkContainer,
|
62
|
-
Feature: ButtonFeatureContainer,
|
63
61
|
}
|
64
|
-
};
|
62
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Button } from './Button.vue'
|
package/dist/card/Card.astro
CHANGED
@@ -57,7 +57,7 @@
|
|
57
57
|
* ```
|
58
58
|
*
|
59
59
|
* @props
|
60
|
-
* @prop {string}
|
60
|
+
* @prop {string} title - 卡片标题
|
61
61
|
* @prop {string} [subtitle] - 卡片副标题或描述
|
62
62
|
* @prop {string} [imageUrl] - 卡片顶部图片的URL
|
63
63
|
* @prop {string} [href] - 如果提供,卡片将变成可点击的链接
|
@@ -73,19 +73,68 @@ import '../style.ts';
|
|
73
73
|
interface Props {
|
74
74
|
title: string;
|
75
75
|
subtitle?: string;
|
76
|
+
imageUrl?: string;
|
77
|
+
href?: string;
|
78
|
+
compact?: boolean;
|
76
79
|
class?: string;
|
77
80
|
}
|
78
81
|
|
79
|
-
const { title, subtitle, class: className } = Astro.props;
|
82
|
+
const { title, subtitle, imageUrl, href, compact, class: className = '' } = Astro.props;
|
83
|
+
|
84
|
+
// 构建卡片样式类
|
85
|
+
const cardClasses = [
|
86
|
+
'cosy:card',
|
87
|
+
'cosy:w-full',
|
88
|
+
'cosy:bg-base-100',
|
89
|
+
'cosy:shadow-xl',
|
90
|
+
'cosy:hover:shadow-2xl',
|
91
|
+
'cosy:transition-all',
|
92
|
+
'cosy:duration-300',
|
93
|
+
'cosy:ease-in-out',
|
94
|
+
compact ? 'cosy:card-compact' : '',
|
95
|
+
href ? 'cosy:cursor-pointer cosy:hover:scale-105 cosy:transform cosy:no-underline' : '',
|
96
|
+
className,
|
97
|
+
]
|
98
|
+
.filter(Boolean)
|
99
|
+
.join(' ');
|
100
|
+
|
101
|
+
// 内容区域的padding类
|
102
|
+
const contentPadding = compact ? 'cosy:p-4' : 'cosy:p-6';
|
103
|
+
|
104
|
+
// 如果是链接卡片,使用a标签,否则使用article标签
|
105
|
+
const Tag = href ? 'a' : 'article';
|
80
106
|
---
|
81
107
|
|
82
|
-
<
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
108
|
+
<Tag class={cardClasses} href={href} {...href && { target: '_self' }}>
|
109
|
+
{
|
110
|
+
imageUrl && (
|
111
|
+
<figure class="not-prose cosy:m-0 cosy:p-0">
|
112
|
+
<img
|
113
|
+
src={imageUrl}
|
114
|
+
alt={title}
|
115
|
+
class="cosy:w-full cosy:h-48 cosy:object-cover cosy:rounded-t-lg"
|
116
|
+
/>
|
117
|
+
</figure>
|
118
|
+
)
|
119
|
+
}
|
120
|
+
|
121
|
+
<div class={`cosy:card-body ${contentPadding}`}>
|
122
|
+
<h2 class="cosy:card-title cosy:text-xl cosy:font-bold">
|
123
|
+
{title}
|
124
|
+
</h2>
|
125
|
+
|
126
|
+
{
|
127
|
+
subtitle && (
|
128
|
+
<p class="cosy:text-base-content/70 cosy:text-sm cosy:leading-relaxed">{subtitle}</p>
|
129
|
+
)
|
130
|
+
}
|
87
131
|
|
88
|
-
|
89
|
-
|
132
|
+
{
|
133
|
+
Astro.slots.has('default') && (
|
134
|
+
<div class="cosy:mt-4">
|
135
|
+
<slot />
|
136
|
+
</div>
|
137
|
+
)
|
138
|
+
}
|
90
139
|
</div>
|
91
|
-
</
|
140
|
+
</Tag>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardBasic from './ECardBasic.astro';
|
4
|
+
import CardBasicSourceCode from './ECardBasic.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardBasicSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardBasic />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Card.Clickable
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 可点击的Card组件示例,展示如何使用href属性创建链接卡片。
|
7
|
+
*/
|
8
|
+
import { Card } from '../index';
|
9
|
+
---
|
10
|
+
|
11
|
+
<Card title="可点击的卡片" subtitle="点击整个卡片区域可以跳转到指定链接" href="#">
|
12
|
+
这是一个可点击的卡片,鼠标悬停时会有缩放效果,点击可以跳转到指定页面。
|
13
|
+
</Card>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardClickable from './ECardClickable.astro';
|
4
|
+
import CardClickableSourceCode from './ECardClickable.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardClickableSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardClickable />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardCompact from './ECardCompact.astro';
|
4
|
+
import CardCompactSourceCode from './ECardCompact.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardCompactSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardCompact />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Card.CustomStyle
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 展示如何使用class属性自定义Card组件的样式。
|
7
|
+
*/
|
8
|
+
import '../style.ts';
|
9
|
+
import { Card } from '../index';
|
10
|
+
---
|
11
|
+
|
12
|
+
<Card
|
13
|
+
title="自定义样式卡片"
|
14
|
+
subtitle="这个卡片使用了自定义的背景色和边框"
|
15
|
+
class="cosy:bg-gradient-to-r cosy:from-blue-50 cosy:to-indigo-100 cosy:border-2 cosy:border-blue-200">
|
16
|
+
这是一个自定义样式的卡片,展示了如何通过class属性来覆盖默认样式。
|
17
|
+
</Card>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardCustomStyle from './ECardCustomStyle.astro';
|
4
|
+
import CardCustomStyleSourceCode from './ECardCustomStyle.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardCustomStyleSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardCustomStyle />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component Card.WithImage
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* 带图片的Card组件示例,展示如何使用imageUrl属性。
|
7
|
+
*/
|
8
|
+
import { Card } from '../index';
|
9
|
+
---
|
10
|
+
|
11
|
+
<Card
|
12
|
+
title="带图片的卡片"
|
13
|
+
subtitle="这张卡片展示了如何添加顶部图片"
|
14
|
+
imageUrl="https://picsum.photos/400/200?random=1">
|
15
|
+
这是一个带有图片的卡片,图片会自动显示在卡片顶部,并适配卡片宽度。
|
16
|
+
</Card>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardWithImage from './ECardWithImage.astro';
|
4
|
+
import CardWithImageSourceCode from './ECardWithImage.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardWithImageSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardWithImage />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import CardWithSubtitle from './ECardWithSubtitle.astro';
|
4
|
+
import CardWithSubtitleSourceCode from './ECardWithSubtitle.astro?raw';
|
5
|
+
---
|
6
|
+
|
7
|
+
<CodeContainer codes={[CardWithSubtitleSourceCode]}>
|
8
|
+
<div id="tab-1">
|
9
|
+
<CardWithSubtitle />
|
10
|
+
</div>
|
11
|
+
</CodeContainer>
|
package/dist/card/index.ts
CHANGED
@@ -1,7 +1,33 @@
|
|
1
|
+
import Card from './Card.astro';
|
2
|
+
import CardCourse from './CardCourse.astro';
|
3
|
+
import CardBasic from './CardBasic.astro';
|
4
|
+
import CardWithImage from './CardWithImage.astro';
|
5
|
+
import CardLink from './CardLink.astro';
|
6
|
+
import CardCompact from './CardCompact.astro';
|
1
7
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
// Container components
|
9
|
+
import CardBasicContainer from './ECardBasicContainer.astro';
|
10
|
+
import CardWithSubtitleContainer from './ECardWithSubtitleContainer.astro';
|
11
|
+
import CardWithImageContainer from './ECardWithImageContainer.astro';
|
12
|
+
import CardClickableContainer from './ECardClickableContainer.astro';
|
13
|
+
import CardCompactContainer from './ECardCompactContainer.astro';
|
14
|
+
import CardCustomStyleContainer from './ECardCustomStyleContainer.astro';
|
15
|
+
|
16
|
+
export { Card };
|
17
|
+
export { CardCourse };
|
18
|
+
export { CardBasic };
|
19
|
+
export { CardWithImage };
|
20
|
+
export { CardLink };
|
21
|
+
export { CardCompact };
|
22
|
+
|
23
|
+
export const CardPackage = {
|
24
|
+
Card,
|
25
|
+
CardContainers: {
|
26
|
+
Basic: CardBasicContainer,
|
27
|
+
WithSubtitle: CardWithSubtitleContainer,
|
28
|
+
WithImage: CardWithImageContainer,
|
29
|
+
Clickable: CardClickableContainer,
|
30
|
+
Compact: CardCompactContainer,
|
31
|
+
CustomStyle: CardCustomStyleContainer,
|
32
|
+
},
|
33
|
+
};
|
@@ -84,7 +84,7 @@ const { titles = [], descriptions = [], codes } = Astro.props;
|
|
84
84
|
data-example={`tab-${index + 1}`}>
|
85
85
|
{/* 描述 */}
|
86
86
|
{descriptions[index] && (
|
87
|
-
<p class="cosy:px-4 cosy:py-2
|
87
|
+
<p class="cosy:px-4 cosy:py-2 cosy:text-sm cosy:bg-gradient-to-b not-prose cosy:from-blue-100/50 cosy:to-blue-100/90 ">
|
88
88
|
{descriptions[index]}
|
89
89
|
</p>
|
90
90
|
)}
|
@@ -113,7 +113,7 @@ const { titles = [], descriptions = [], codes } = Astro.props;
|
|
113
113
|
const exampleTabs = document.querySelectorAll('[role="tab"][data-tab^="tab-"]');
|
114
114
|
exampleTabs.forEach((tab) => {
|
115
115
|
tab.addEventListener('click', () => {
|
116
|
-
console.log('CodeContainer: 切换示例', tab);
|
116
|
+
console.log('CodeContainer: 切换示例', tab.getAttribute('data-tab'));
|
117
117
|
const container = tab.closest('[data-role="code-container"]');
|
118
118
|
if (!container) return;
|
119
119
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { default as CodeContainer } from './CodeContainer.astro';
|
2
|
-
import { default as CodeContainerBasic } from './
|
3
|
-
import { default as CodeContainerMultiple } from './
|
4
|
-
import BasicSourceCode from './
|
5
|
-
import MultipleSourceCode from './
|
2
|
+
import { default as CodeContainerBasic } from './ECodeContainerBasic.astro';
|
3
|
+
import { default as CodeContainerMultiple } from './ECodeContainerMultiple.astro';
|
4
|
+
import BasicSourceCode from './ECodeContainerBasic.astro?raw';
|
5
|
+
import MultipleSourceCode from './ECodeContainerMultiple.astro?raw';
|
6
6
|
import { extractSimpleExample } from '../utils/component';
|
7
7
|
|
8
8
|
export { CodeContainer, CodeContainerBasic, CodeContainerMultiple };
|
9
9
|
|
10
10
|
// 导出示例源代码
|
11
11
|
export const CodeContainerExampleCodes = {
|
12
|
-
|
13
|
-
|
14
|
-
};
|
12
|
+
Basic: extractSimpleExample(BasicSourceCode, 'CodeContainer'),
|
13
|
+
Multiple: extractSimpleExample(MultipleSourceCode, 'CodeContainer'),
|
14
|
+
};
|