@coffic/cosy-ui 0.6.32 → 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/{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 +42 -14
- 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 +3 -2
- 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 -26
- package/dist/index_vue.ts +1 -4
- 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/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/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
@@ -10,13 +10,13 @@
|
|
10
10
|
* 设计理念:
|
11
11
|
* 1. 视觉冲击力 - 使用大号字体和醒目的背景,确保信息能够被用户注意到
|
12
12
|
* 2. 简洁明了 - 简单的布局和充足的留白,让信息更容易被理解
|
13
|
-
* 3. 动态效果 -
|
13
|
+
* 3. 动态效果 - 支持多种动画效果选择
|
14
14
|
* 4. 响应式设计 - 在不同屏幕尺寸下保持良好的可读性
|
15
15
|
*
|
16
16
|
* 视觉特点:
|
17
17
|
* - 圆角设计:柔和的视觉效果
|
18
18
|
* - 悬停效果:轻微放大和阴影增强,提供交互反馈
|
19
|
-
* -
|
19
|
+
* - 动画效果:支持淡入、上滑或组合动画
|
20
20
|
* - 模糊背景:半透明背景配合模糊效果,现代感强
|
21
21
|
*
|
22
22
|
* @usage
|
@@ -25,11 +25,9 @@
|
|
25
25
|
* <Banner>欢迎使用我们的服务</Banner>
|
26
26
|
* ```
|
27
27
|
*
|
28
|
-
*
|
28
|
+
* 指定动画效果:
|
29
29
|
* ```astro
|
30
|
-
* <
|
31
|
-
* <Banner>构建美好的数字体验</Banner>
|
32
|
-
* </footer>
|
30
|
+
* <Banner animation="fade">淡入效果的横幅</Banner>
|
33
31
|
* ```
|
34
32
|
*
|
35
33
|
* @slots
|
@@ -40,7 +38,7 @@
|
|
40
38
|
* - 动画遵循 prefers-reduced-motion 媒体查询,尊重用户的动画偏好设置
|
41
39
|
*/
|
42
40
|
|
43
|
-
import '
|
41
|
+
import '../style.ts';
|
44
42
|
|
45
43
|
interface Props {
|
46
44
|
/**
|
@@ -59,12 +57,31 @@ interface Props {
|
|
59
57
|
textColor?: string;
|
60
58
|
|
61
59
|
/**
|
62
|
-
*
|
60
|
+
* 动画效果类型,可选值:
|
61
|
+
* - 'none': 无动画
|
62
|
+
* - 'fade': 仅淡入效果
|
63
|
+
* - 'slide': 仅上滑效果
|
64
|
+
* - 'both': 淡入和上滑效果
|
65
|
+
* 默认为'both'
|
66
|
+
*/
|
67
|
+
animation?: 'none' | 'fade' | 'slide' | 'both';
|
68
|
+
|
69
|
+
/**
|
70
|
+
* @deprecated 使用animation属性替代
|
63
71
|
*/
|
64
72
|
animated?: boolean;
|
65
73
|
}
|
66
74
|
|
67
|
-
const {
|
75
|
+
const {
|
76
|
+
class: className = '',
|
77
|
+
bgColor = 'primary',
|
78
|
+
textColor = '',
|
79
|
+
animation = 'both',
|
80
|
+
animated, // 向后兼容
|
81
|
+
} = Astro.props;
|
82
|
+
|
83
|
+
// 处理向后兼容
|
84
|
+
const effectiveAnimation = animated === false ? 'none' : animation;
|
68
85
|
|
69
86
|
// 根据背景色自动设置文本颜色
|
70
87
|
const getTextColorClass = () => {
|
@@ -99,7 +116,12 @@ const bannerClasses = [
|
|
99
116
|
].join(' ');
|
100
117
|
|
101
118
|
// 动画类
|
102
|
-
const animationClasses =
|
119
|
+
const animationClasses = {
|
120
|
+
none: '',
|
121
|
+
fade: 'cosy:animate-fadeIn',
|
122
|
+
slide: 'cosy:animate-slideUp',
|
123
|
+
both: 'cosy:animate-fadeIn cosy:animate-slideUp',
|
124
|
+
}[effectiveAnimation];
|
103
125
|
---
|
104
126
|
|
105
127
|
<div class={`${bannerClasses} ${animationClasses}`}>
|
@@ -134,7 +156,6 @@ const animationClasses = animated ? 'cosy:animate-fadeIn cosy:animate-slideUp' :
|
|
134
156
|
animation: slideUp 0.5s ease-out;
|
135
157
|
}
|
136
158
|
|
137
|
-
/* 尊重用户的减少动画偏好 */
|
138
159
|
@media (prefers-reduced-motion: reduce) {
|
139
160
|
.cosy\:animate-fadeIn,
|
140
161
|
.cosy\:animate-slideUp {
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
import { Banner } from '../index';
|
3
|
+
---
|
4
|
+
|
5
|
+
<div class="flex flex-col gap-4">
|
6
|
+
<Banner animation="none">这是一个没有动画的横幅</Banner>
|
7
|
+
<Banner animation="fade">这是一个只有淡入动画的横幅</Banner>
|
8
|
+
<Banner animation="slide">这是一个只有上滑动画的横幅</Banner>
|
9
|
+
<Banner animation="both">这是一个同时有淡入和上滑动画的横幅</Banner>
|
10
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import Banner from './Banner.astro';
|
2
|
+
import BannerBasic from './BannerBasic.astro';
|
3
|
+
import BannerPrimary from './BannerPrimary.astro';
|
4
|
+
import BannerSecondary from './BannerSecondary.astro';
|
5
|
+
import BannerSuccess from './BannerSuccess.astro';
|
6
|
+
import BannerWarning from './BannerWarning.astro';
|
7
|
+
import BannerDanger from './BannerDanger.astro';
|
8
|
+
import BannerInfo from './BannerInfo.astro';
|
9
|
+
import BannerCustomStyle from './BannerCustomStyle.astro';
|
10
|
+
import BannerFadeIn from './BannerFadeIn.astro';
|
11
|
+
import BannerSlideUp from './BannerSlideUp.astro';
|
12
|
+
import BannerAllAnimations from './BannerAllAnimations.astro';
|
13
|
+
import BasicSourceCode from './BannerBasic.astro?raw';
|
14
|
+
import PrimarySourceCode from './BannerPrimary.astro?raw';
|
15
|
+
import SecondarySourceCode from './BannerSecondary.astro?raw';
|
16
|
+
import SuccessSourceCode from './BannerSuccess.astro?raw';
|
17
|
+
import WarningSourceCode from './BannerWarning.astro?raw';
|
18
|
+
import DangerSourceCode from './BannerDanger.astro?raw';
|
19
|
+
import InfoSourceCode from './BannerInfo.astro?raw';
|
20
|
+
import CustomStyleSourceCode from './BannerCustomStyle.astro?raw';
|
21
|
+
import FadeInSourceCode from './BannerFadeIn.astro?raw';
|
22
|
+
import SlideUpSourceCode from './BannerSlideUp.astro?raw';
|
23
|
+
import AllAnimationsSourceCode from './BannerAllAnimations.astro?raw';
|
24
|
+
import { extractSimpleExample } from '../utils/component';
|
25
|
+
|
26
|
+
export { Banner, BannerBasic, BannerPrimary, BannerSecondary, BannerSuccess, BannerWarning, BannerDanger, BannerInfo, BannerCustomStyle, BannerFadeIn, BannerSlideUp, BannerAllAnimations };
|
27
|
+
|
28
|
+
// 导出示例源代码
|
29
|
+
export const BannerExampleCodes = {
|
30
|
+
Basic: extractSimpleExample(BasicSourceCode, 'Banner'),
|
31
|
+
Primary: extractSimpleExample(PrimarySourceCode, 'Banner'),
|
32
|
+
Secondary: extractSimpleExample(SecondarySourceCode, 'Banner'),
|
33
|
+
Success: extractSimpleExample(SuccessSourceCode, 'Banner'),
|
34
|
+
Warning: extractSimpleExample(WarningSourceCode, 'Banner'),
|
35
|
+
Danger: extractSimpleExample(DangerSourceCode, 'Banner'),
|
36
|
+
Info: extractSimpleExample(InfoSourceCode, 'Banner'),
|
37
|
+
CustomStyle: extractSimpleExample(CustomStyleSourceCode, 'Banner'),
|
38
|
+
FadeIn: extractSimpleExample(FadeInSourceCode, 'Banner'),
|
39
|
+
SlideUp: extractSimpleExample(SlideUpSourceCode, 'Banner'),
|
40
|
+
AllAnimations: extractSimpleExample(AllAnimationsSourceCode, 'Banner'),
|
41
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {default as Blog} from './Blog.astro';
|
package/dist/button/Button.astro
CHANGED
@@ -46,6 +46,12 @@
|
|
46
46
|
* 左侧图标
|
47
47
|
* </Button>
|
48
48
|
* ```
|
49
|
+
*
|
50
|
+
* 链接按钮:
|
51
|
+
* ```astro
|
52
|
+
* <Button href="https://example.com">跳转链接</Button>
|
53
|
+
* <Button href="https://example.com" target="_blank">新窗口打开</Button>
|
54
|
+
* ```
|
49
55
|
*/
|
50
56
|
|
51
57
|
// 导入样式
|
@@ -74,6 +80,8 @@ interface Props {
|
|
74
80
|
class?: string;
|
75
81
|
onClick?: string;
|
76
82
|
formmethod?: string;
|
83
|
+
href?: string;
|
84
|
+
target?: string;
|
77
85
|
[key: string]: any; // 允许任意自定义属性
|
78
86
|
}
|
79
87
|
|
@@ -89,6 +97,8 @@ const {
|
|
89
97
|
class: className,
|
90
98
|
onClick,
|
91
99
|
formmethod,
|
100
|
+
href,
|
101
|
+
target,
|
92
102
|
...rest
|
93
103
|
} = Astro.props;
|
94
104
|
|
@@ -148,17 +158,35 @@ const getButtonClasses = () => {
|
|
148
158
|
const buttonClasses = getButtonClasses();
|
149
159
|
---
|
150
160
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
</
|
161
|
+
{
|
162
|
+
href ? (
|
163
|
+
<a
|
164
|
+
href={href}
|
165
|
+
class:list={buttonClasses}
|
166
|
+
target={target}
|
167
|
+
onclick={onClick}
|
168
|
+
data-variant={variant}
|
169
|
+
{...rest}>
|
170
|
+
<span class="cosy:flex cosy:items-center cosy:gap-2">
|
171
|
+
<slot name="icon-left" />
|
172
|
+
<slot />
|
173
|
+
<slot name="icon-right" />
|
174
|
+
</span>
|
175
|
+
</a>
|
176
|
+
) : (
|
177
|
+
<button
|
178
|
+
type={formmethod === 'dialog' ? 'submit' : type}
|
179
|
+
class:list={buttonClasses}
|
180
|
+
disabled={disabled}
|
181
|
+
onclick={onClick}
|
182
|
+
formmethod={formmethod}
|
183
|
+
data-variant={variant}
|
184
|
+
{...rest}>
|
185
|
+
<span class="cosy:flex cosy:items-center cosy:gap-2">
|
186
|
+
<slot name="icon-left" />
|
187
|
+
<slot />
|
188
|
+
<slot name="icon-right" />
|
189
|
+
</span>
|
190
|
+
</button>
|
191
|
+
)
|
192
|
+
}
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { computed } from 'vue'
|
3
|
+
|
4
|
+
interface Props {
|
5
|
+
variant?:
|
6
|
+
| 'primary'
|
7
|
+
| 'secondary'
|
8
|
+
| 'accent'
|
9
|
+
| 'info'
|
10
|
+
| 'success'
|
11
|
+
| 'warning'
|
12
|
+
| 'error'
|
13
|
+
| 'ghost'
|
14
|
+
| 'link'
|
15
|
+
| 'outline'
|
16
|
+
| 'neutral'
|
17
|
+
size?: 'lg' | 'md' | 'sm' | 'xs'
|
18
|
+
shape?: 'circle' | 'square'
|
19
|
+
wide?: boolean
|
20
|
+
block?: boolean
|
21
|
+
loading?: boolean
|
22
|
+
disabled?: boolean
|
23
|
+
type?: 'button' | 'submit' | 'reset'
|
24
|
+
href?: string
|
25
|
+
target?: string
|
26
|
+
}
|
27
|
+
|
28
|
+
const props = withDefaults(defineProps<Props>(), {
|
29
|
+
variant: 'primary',
|
30
|
+
size: 'md',
|
31
|
+
wide: false,
|
32
|
+
block: false,
|
33
|
+
loading: false,
|
34
|
+
disabled: false,
|
35
|
+
type: 'button'
|
36
|
+
})
|
37
|
+
|
38
|
+
const buttonClasses = computed(() => {
|
39
|
+
const classes = ['cosy:btn']
|
40
|
+
|
41
|
+
// Variant classes
|
42
|
+
const variantClasses = {
|
43
|
+
primary: 'cosy:btn-primary',
|
44
|
+
secondary: 'cosy:btn-secondary',
|
45
|
+
accent: 'cosy:btn-accent',
|
46
|
+
info: 'cosy:btn-info',
|
47
|
+
success: 'cosy:btn-success',
|
48
|
+
warning: 'cosy:btn-warning',
|
49
|
+
error: 'cosy:btn-error',
|
50
|
+
ghost: 'cosy:btn-ghost',
|
51
|
+
link: 'cosy:btn-link',
|
52
|
+
outline: 'cosy:btn-outline',
|
53
|
+
neutral: 'cosy:btn-neutral',
|
54
|
+
}
|
55
|
+
|
56
|
+
// Size classes
|
57
|
+
const sizeClasses = {
|
58
|
+
lg: 'cosy:btn-lg',
|
59
|
+
md: 'cosy:btn-md',
|
60
|
+
sm: 'cosy:btn-sm',
|
61
|
+
xs: 'cosy:btn-xs',
|
62
|
+
}
|
63
|
+
|
64
|
+
// Shape classes
|
65
|
+
const shapeClasses = {
|
66
|
+
circle: 'cosy:btn-circle',
|
67
|
+
square: 'cosy:btn-square',
|
68
|
+
}
|
69
|
+
|
70
|
+
if (variantClasses[props.variant]) {
|
71
|
+
classes.push(variantClasses[props.variant])
|
72
|
+
}
|
73
|
+
|
74
|
+
if (sizeClasses[props.size]) {
|
75
|
+
classes.push(sizeClasses[props.size])
|
76
|
+
}
|
77
|
+
|
78
|
+
if (props.shape && shapeClasses[props.shape]) {
|
79
|
+
classes.push(shapeClasses[props.shape])
|
80
|
+
}
|
81
|
+
|
82
|
+
if (props.wide) classes.push('cosy:btn-wide')
|
83
|
+
if (props.block) classes.push('cosy:btn-block')
|
84
|
+
if (props.loading) classes.push('cosy:loading')
|
85
|
+
|
86
|
+
return classes
|
87
|
+
})
|
88
|
+
</script>
|
89
|
+
|
90
|
+
<template>
|
91
|
+
<component
|
92
|
+
:is="props.href ? 'a' : 'button'"
|
93
|
+
:class="buttonClasses"
|
94
|
+
:type="props.href ? undefined : props.type"
|
95
|
+
:disabled="props.disabled"
|
96
|
+
:href="props.href"
|
97
|
+
:target="props.target"
|
98
|
+
>
|
99
|
+
<span class="cosy:flex cosy:items-center cosy:gap-2">
|
100
|
+
<slot name="icon-left" />
|
101
|
+
<slot />
|
102
|
+
<slot name="icon-right" />
|
103
|
+
</span>
|
104
|
+
</component>
|
105
|
+
</template>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import Button from './Button.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div class="cosy:flex cosy:gap-2">
|
7
|
+
<Button>默认按钮</Button>
|
8
|
+
<Button variant="primary">主要按钮</Button>
|
9
|
+
<Button variant="secondary">次要按钮</Button>
|
10
|
+
</div>
|
11
|
+
</template>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import ButtonBasic from './ButtonBasic.astro';
|
4
|
+
import VueButtonBasic from './ButtonBasic.vue';
|
5
|
+
import ButtonBasicSourceCode from './ButtonBasic.astro?raw';
|
6
|
+
import VueButtonBasicSourceCode from './ButtonBasic.vue?raw';
|
7
|
+
---
|
8
|
+
|
9
|
+
<CodeContainer codes={[ButtonBasicSourceCode, VueButtonBasicSourceCode]} titles={['Astro', 'Vue']}>
|
10
|
+
<div id="tab-1">
|
11
|
+
<ButtonBasic />
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div id="tab-2">
|
15
|
+
<VueButtonBasic client:load />
|
16
|
+
</div>
|
17
|
+
</CodeContainer>
|
@@ -1,27 +1,4 @@
|
|
1
|
-
<template>
|
2
|
-
<div>
|
3
|
-
<!-- Button with hover effects -->
|
4
|
-
<button :class="[
|
5
|
-
'cosy:bg-cyan-500/20 cosy:text-cyan-500 cosy:border-cyan-500 cosy:border-2 cosy:hover:bg-cyan-500/30 cosy:hover:text-white cosy:hover:border-cyan-500/30 cosy:hover:scale-105 cosy:transition-all cosy:duration-300 cosy:rounded-2xl cosy:text-center cosy:backdrop-blur-lg cosy:text-2xl',
|
6
|
-
props.size
|
7
|
-
]" @click="showPopup">
|
8
|
-
<slot />
|
9
|
-
{{ props.title }}
|
10
|
-
</button>
|
11
1
|
|
12
|
-
<!-- Popup message -->
|
13
|
-
<Transition name="fade">
|
14
|
-
<div v-if="isPopupVisible"
|
15
|
-
class="cosy:fixed cosy:inset-0 cosy:flex cosy:items-center cosy:justify-center cosy:z-50"
|
16
|
-
@click="hidePopup">
|
17
|
-
<div
|
18
|
-
class="cosy:bg-black/80 cosy:backdrop-blur-sm cosy:p-6 cosy:rounded-xl cosy:text-white cosy:animate-popup">
|
19
|
-
{{ lang === 'zh' ? '这是展示图,不支持操作' : 'This is a preview image, no operation is supported' }}
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
</Transition>
|
23
|
-
</div>
|
24
|
-
</template>
|
25
2
|
|
26
3
|
<script setup lang="ts">
|
27
4
|
import { ref } from 'vue'
|
@@ -61,7 +38,30 @@ const hidePopup = () => {
|
|
61
38
|
isPopupVisible.value = false
|
62
39
|
}
|
63
40
|
</script>
|
41
|
+
<template>
|
42
|
+
<div>
|
43
|
+
<!-- Button with hover effects -->
|
44
|
+
<button :class="[
|
45
|
+
'cosy:bg-cyan-500/20 cosy:text-cyan-500 cosy:border-cyan-500 cosy:border-2 cosy:hover:bg-cyan-500/30 cosy:hover:text-white cosy:hover:border-cyan-500/30 cosy:hover:scale-105 cosy:transition-all cosy:duration-300 cosy:rounded-2xl cosy:text-center cosy:backdrop-blur-lg cosy:text-2xl',
|
46
|
+
props.size
|
47
|
+
]" @click="showPopup">
|
48
|
+
<slot />
|
49
|
+
{{ props.title }}
|
50
|
+
</button>
|
64
51
|
|
52
|
+
<!-- Popup message -->
|
53
|
+
<Transition name="fade">
|
54
|
+
<div v-if="isPopupVisible"
|
55
|
+
class="cosy:fixed cosy:inset-0 cosy:flex cosy:items-center cosy:justify-center cosy:z-50"
|
56
|
+
@click="hidePopup">
|
57
|
+
<div
|
58
|
+
class="cosy:bg-black/80 cosy:backdrop-blur-sm cosy:p-6 cosy:rounded-xl cosy:text-white cosy:animate-popup">
|
59
|
+
{{ lang === 'zh' ? '这是展示图,不支持操作' : 'This is a preview image, no operation is supported' }}
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</Transition>
|
63
|
+
</div>
|
64
|
+
</template>
|
65
65
|
<style scoped>
|
66
66
|
.fade-enter-active,
|
67
67
|
.fade-leave-active {
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import ButtonFeatureBasic from './ButtonFeatureBasic.vue';
|
4
|
+
import ButtonFeatureWithTips from './ButtonFeatureWithTips.vue';
|
5
|
+
import ButtonFeatureBasicSourceCode from './ButtonFeatureBasic.vue?raw';
|
6
|
+
import ButtonFeatureWithTipsSourceCode from './ButtonFeatureWithTips.vue?raw';
|
7
|
+
---
|
8
|
+
|
9
|
+
<CodeContainer
|
10
|
+
titles={['Vue-基础用法', 'Vue-带提示功能']}
|
11
|
+
codes={[ButtonFeatureBasicSourceCode, ButtonFeatureWithTipsSourceCode]}>
|
12
|
+
<div id="tab-1">
|
13
|
+
<ButtonFeatureBasic client:load />
|
14
|
+
</div>
|
15
|
+
<div id="tab-2">
|
16
|
+
<ButtonFeatureWithTips client:load />
|
17
|
+
</div>
|
18
|
+
</CodeContainer>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import VueButton from './Button.vue'
|
3
|
+
</script>
|
4
|
+
|
5
|
+
<template>
|
6
|
+
<div class="cosy:flex cosy:gap-2">
|
7
|
+
<VueButton href="#" variant="primary">内部链接</VueButton>
|
8
|
+
<VueButton href="https://example.com" target="_blank" variant="primary">
|
9
|
+
外部链接
|
10
|
+
<template #icon-right>↗</template>
|
11
|
+
</VueButton>
|
12
|
+
</div>
|
13
|
+
</template>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
import { CodeContainer } from '../index';
|
3
|
+
import ButtonLink from './ButtonLink.astro';
|
4
|
+
import VueButtonLink from './ButtonLink.vue';
|
5
|
+
import ButtonLinkExternal from './ButtonLinkExternal.astro';
|
6
|
+
import ButtonLinkSourceCode from './ButtonLink.astro?raw';
|
7
|
+
import VueButtonLinkSourceCode from './ButtonLink.vue?raw';
|
8
|
+
import ButtonLinkExternalSourceCode from './ButtonLinkExternal.astro?raw';
|
9
|
+
---
|
10
|
+
|
11
|
+
<CodeContainer
|
12
|
+
titles={['基础链接', '外部链接', 'Vue']}
|
13
|
+
codes={[ButtonLinkSourceCode, ButtonLinkExternalSourceCode, VueButtonLinkSourceCode]}>
|
14
|
+
<div id="tab-1">
|
15
|
+
<ButtonLink />
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div id="tab-2">
|
19
|
+
<ButtonLinkExternal />
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div id="tab-3">
|
23
|
+
<VueButtonLink client:load />
|
24
|
+
</div>
|
25
|
+
</CodeContainer>
|