@coffic/cosy-ui 0.6.10 → 0.6.14
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/assets/iconData.ts +93 -0
- package/dist/components/base/Alert.astro +1 -1
- package/dist/components/base/Button.astro +102 -91
- package/dist/components/base/Image.astro +1 -1
- package/dist/components/base/Link.astro +1 -1
- package/dist/components/containers/Container.astro +1 -1
- package/dist/components/containers/Main.astro +1 -1
- package/dist/components/containers/Section.astro +96 -94
- package/dist/components/data-display/Blog.astro +1 -1
- package/dist/components/data-display/ProductCard.astro +2 -4
- package/dist/components/data-display/Products.astro +2 -2
- package/dist/components/data-display/TeamMember.astro +2 -4
- package/dist/components/data-display/TeamMembers.astro +1 -1
- package/dist/components/display/Banner.astro +1 -1
- package/dist/components/display/Card.astro +1 -1
- package/dist/components/display/CodeBlock.astro +1 -1
- package/dist/components/display/CodeExample.astro +1 -1
- package/dist/components/display/Hero.astro +1 -1
- package/dist/components/display/Modal.astro +1 -1
- package/dist/components/layouts/AppLayout.astro +2 -6
- package/dist/components/layouts/BaseLayout.astro +1 -1
- package/dist/components/layouts/DashboardLayout.astro +1 -1
- package/dist/components/layouts/Footer.astro +2 -5
- package/dist/components/layouts/Grid.astro +1 -1
- package/dist/components/layouts/Header.astro +1 -1
- package/dist/components/layouts/NavItems.astro +1 -1
- package/dist/components/layouts/Sidebar.astro +2 -2
- package/dist/components/layouts/SidebarNav.astro +1 -1
- package/dist/components/layouts/Stack.astro +72 -70
- package/dist/components/navigation/LanguageSwitcher.astro +2 -2
- package/dist/components/navigation/TableOfContents.astro +1 -1
- package/dist/components/navigation/ThemeSwitcher.astro +2 -2
- package/dist/components/typography/Article.astro +2 -2
- package/dist/components/typography/Heading.astro +2 -2
- package/dist/components/typography/Text.astro +1 -1
- package/dist/icons/AlertTriangle.astro +24 -0
- package/dist/icons/AstroIcon.astro +46 -0
- package/dist/icons/CalendarIcon.astro +24 -0
- package/dist/icons/CheckCircle.astro +23 -0
- package/dist/icons/CheckIcon.astro +27 -0
- package/dist/{components/icons → icons}/ChevronDownIcon.astro +3 -13
- package/dist/icons/ClipboardIcon.astro +27 -0
- package/dist/icons/CloseIcon.astro +27 -0
- package/dist/icons/ErrorIcon.astro +24 -0
- package/dist/icons/GithubIcon.astro +24 -0
- package/dist/icons/InfoCircle.astro +24 -0
- package/dist/icons/InfoIcon.astro +26 -0
- package/dist/icons/LinkIcon.astro +27 -0
- package/dist/icons/LinkedinIcon.astro +23 -0
- package/dist/icons/MenuIcon.astro +27 -0
- package/dist/icons/SearchIcon.astro +23 -0
- package/dist/icons/SettingsIcon.astro +18 -0
- package/dist/{components/icons → icons}/SocialIcon.astro +14 -14
- package/dist/icons/SuccessIcon.astro +24 -0
- package/dist/icons/SunCloudyIcon.astro +23 -0
- package/dist/icons/TwitterIcon.astro +24 -0
- package/dist/icons/UserIcon.astro +24 -0
- package/dist/icons/WarningIcon.astro +27 -0
- package/dist/icons/XCircle.astro +24 -0
- package/dist/index.ts +1 -1
- package/dist/index_icons.ts +23 -0
- package/dist/index_vue.ts +41 -0
- package/dist/vue/{AlertDialog.vue → AlertDialog/AlertDialog.vue} +1 -1
- package/dist/vue/AlertDialog/Basic.vue +38 -0
- package/dist/vue/AlertDialog/Multilang.vue +48 -0
- package/dist/vue/AlertDialog/index.ts +58 -0
- package/dist/vue/BannerBox/BannerBox.vue +435 -0
- package/dist/vue/BannerBox/Basic.vue +32 -0
- package/dist/vue/BannerBox/CustomBg.vue +32 -0
- package/dist/vue/BannerBox/CustomComponent.vue +60 -0
- package/dist/vue/BannerBox/DisplayMode.vue +49 -0
- package/dist/vue/{FeatureCard.vue → BannerBox/FeatureCard.vue} +23 -42
- package/dist/vue/BannerBox/ImageExport.vue +37 -0
- package/dist/vue/BannerBox/SizePreset.vue +35 -0
- package/dist/vue/BannerBox/SmartBanner.vue +44 -0
- package/dist/vue/BannerBox/index.ts +76 -0
- package/dist/vue/FeatureButton.vue +25 -26
- package/dist/vue/Icons/AlertTriangleIcon.vue +30 -0
- package/dist/vue/Icons/CalendarIcon.vue +30 -0
- package/dist/vue/Icons/CheckCircleIcon.vue +30 -0
- package/dist/vue/Icons/CheckIcon.vue +30 -0
- package/dist/vue/Icons/ChevronDownIcon.vue +30 -0
- package/dist/vue/Icons/ClipboardIcon.vue +30 -0
- package/dist/vue/Icons/CloseIcon.vue +30 -0
- package/dist/vue/Icons/InfoCircleIcon.vue +30 -0
- package/dist/vue/Icons/InfoIcon.vue +30 -0
- package/dist/vue/Icons/LinkIcon.vue +30 -0
- package/dist/vue/Icons/MenuIcon.vue +30 -0
- package/dist/vue/Icons/SearchIcon.vue +30 -0
- package/dist/vue/Icons/SettingsIcon.vue +30 -0
- package/dist/vue/Icons/UserIcon.vue +30 -0
- package/dist/vue/Icons/VueIcon.vue +76 -0
- package/dist/vue/Icons/XCircleIcon.vue +30 -0
- package/dist/vue/MacWindow/Basic.vue +11 -0
- package/dist/vue/MacWindow/CustomHeight.vue +13 -0
- package/dist/vue/{MacWindow.vue → MacWindow/MacWindow.vue} +73 -38
- package/dist/vue/MacWindow/WithEvents.vue +34 -0
- package/dist/vue/MacWindow/WithSidebar.vue +21 -0
- package/dist/vue/MacWindow/WithTabs.vue +21 -0
- package/dist/vue/MacWindow/WithToolbar.vue +43 -0
- package/dist/vue/MacWindow/index.ts +50 -0
- package/dist/vue/SmartHero.vue +28 -34
- package/dist/vue/VueCounter.vue +29 -0
- package/dist/vue/iPhone/Basic.vue +33 -0
- package/dist/vue/iPhone/CustomBackground.vue +33 -0
- package/dist/vue/iPhone/NoFrame.vue +33 -0
- package/dist/vue/iPhone/WeatherApp.vue +97 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
- package/dist/vue/{iPhoneWindow.vue → iPhone/iPhoneWindow.vue} +14 -7
- package/dist/vue/iPhone/index.ts +41 -0
- package/dist/vue/shims-vue.d.ts +5 -0
- package/package.json +13 -12
- package/dist/components/icons/AlertTriangle.astro +0 -35
- package/dist/components/icons/CalendarIcon.astro +0 -38
- package/dist/components/icons/CheckCircle.astro +0 -36
- package/dist/components/icons/CheckIcon.astro +0 -38
- package/dist/components/icons/ClipboardIcon.astro +0 -39
- package/dist/components/icons/CloseIcon.astro +0 -38
- package/dist/components/icons/ErrorIcon.astro +0 -35
- package/dist/components/icons/GithubIcon.astro +0 -31
- package/dist/components/icons/InfoCircle.astro +0 -37
- package/dist/components/icons/InfoIcon.astro +0 -38
- package/dist/components/icons/LinkIcon.astro +0 -39
- package/dist/components/icons/LinkedinIcon.astro +0 -31
- package/dist/components/icons/MenuIcon.astro +0 -38
- package/dist/components/icons/SearchIcon.astro +0 -36
- package/dist/components/icons/SettingsIcon.astro +0 -36
- package/dist/components/icons/SuccessIcon.astro +0 -35
- package/dist/components/icons/SunCloudyIcon.astro +0 -41
- package/dist/components/icons/TwitterIcon.astro +0 -31
- package/dist/components/icons/UserIcon.astro +0 -35
- package/dist/components/icons/WarningIcon.astro +0 -38
- package/dist/components/icons/XCircle.astro +0 -37
- package/dist/entities/Banner.ts +0 -105
- package/dist/icons.ts +0 -22
- package/dist/vue/BannerBox.vue +0 -267
- package/dist/vue/FeatureGroup.vue +0 -22
- package/dist/vue/SmartBanner.vue +0 -45
- package/dist/vue/WildBanner.vue +0 -15
- package/dist/vue.ts +0 -14
- /package/dist/{collection.ts → index_collection.ts} +0 -0
@@ -1,44 +1,44 @@
|
|
1
1
|
---
|
2
2
|
/**
|
3
3
|
* @component Button
|
4
|
-
*
|
4
|
+
*
|
5
5
|
* @description
|
6
6
|
* Button 组件用于触发一个即时操作,如表单提交、打开对话框等。
|
7
7
|
* 支持多种样式变体、尺寸和状态,可以满足不同场景的需求。
|
8
|
-
*
|
8
|
+
*
|
9
9
|
* @design
|
10
10
|
* 设计理念:
|
11
11
|
* 1. 直观易用 - 通过视觉差异清晰传达按钮的重要性和功能
|
12
12
|
* 2. 响应式交互 - 提供丰富的状态反馈,增强用户体验
|
13
13
|
* 3. 可定制性 - 支持多种配置选项,适应不同场景需求
|
14
14
|
* 4. 无障碍性 - 确保所有用户都能获得良好体验
|
15
|
-
*
|
15
|
+
*
|
16
16
|
* 视觉特点:
|
17
17
|
* - 悬停效果:轻微上浮和阴影增强
|
18
18
|
* - 点击效果:轻微下沉
|
19
19
|
* - 加载状态:显示加载动画
|
20
20
|
* - 多种颜色变体:适应不同场景和语义
|
21
21
|
* - 多种尺寸:适应不同布局需求
|
22
|
-
*
|
22
|
+
*
|
23
23
|
* @usage
|
24
24
|
* 基本用法:
|
25
25
|
* ```astro
|
26
26
|
* <Button>默认按钮</Button>
|
27
27
|
* <Button variant="primary">主要按钮</Button>
|
28
28
|
* ```
|
29
|
-
*
|
29
|
+
*
|
30
30
|
* 不同尺寸:
|
31
31
|
* ```astro
|
32
32
|
* <Button size="sm">小型按钮</Button>
|
33
33
|
* <Button size="lg">大型按钮</Button>
|
34
34
|
* ```
|
35
|
-
*
|
35
|
+
*
|
36
36
|
* 状态变化:
|
37
37
|
* ```astro
|
38
38
|
* <Button disabled>禁用按钮</Button>
|
39
39
|
* <Button loading>加载中</Button>
|
40
40
|
* ```
|
41
|
-
*
|
41
|
+
*
|
42
42
|
* 带图标:
|
43
43
|
* ```astro
|
44
44
|
* <Button>
|
@@ -49,103 +49,114 @@
|
|
49
49
|
*/
|
50
50
|
|
51
51
|
// 导入样式
|
52
|
-
import '../../
|
52
|
+
import '../../style.ts';
|
53
53
|
|
54
54
|
interface Props {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
variant?:
|
56
|
+
| 'primary'
|
57
|
+
| 'secondary'
|
58
|
+
| 'accent'
|
59
|
+
| 'info'
|
60
|
+
| 'success'
|
61
|
+
| 'warning'
|
62
|
+
| 'error'
|
63
|
+
| 'ghost'
|
64
|
+
| 'link'
|
65
|
+
| 'outline'
|
66
|
+
| 'neutral';
|
67
|
+
size?: 'lg' | 'md' | 'sm' | 'xs';
|
68
|
+
shape?: 'circle' | 'square';
|
69
|
+
wide?: boolean;
|
70
|
+
block?: boolean;
|
71
|
+
loading?: boolean;
|
72
|
+
disabled?: boolean;
|
73
|
+
type?: 'button' | 'submit' | 'reset';
|
74
|
+
class?: string;
|
75
|
+
onClick?: string;
|
76
|
+
formmethod?: string;
|
66
77
|
}
|
67
78
|
|
68
79
|
const {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
+
variant = 'primary',
|
81
|
+
size = 'md',
|
82
|
+
shape,
|
83
|
+
wide = false,
|
84
|
+
block = false,
|
85
|
+
loading = false,
|
86
|
+
disabled = false,
|
87
|
+
type = 'button',
|
88
|
+
class: className,
|
89
|
+
onClick,
|
90
|
+
formmethod,
|
80
91
|
} = Astro.props;
|
81
92
|
|
82
93
|
// 计算按钮的类名
|
83
94
|
const getButtonClasses = () => {
|
84
|
-
|
85
|
-
|
86
|
-
// Variant classes
|
87
|
-
const variantClasses = {
|
88
|
-
primary: 'cosy:btn-primary',
|
89
|
-
secondary: 'cosy:btn-secondary',
|
90
|
-
accent: 'cosy:btn-accent',
|
91
|
-
info: 'cosy:btn-info',
|
92
|
-
success: 'cosy:btn-success',
|
93
|
-
warning: 'cosy:btn-warning',
|
94
|
-
error: 'cosy:btn-error',
|
95
|
-
ghost: 'cosy:btn-ghost',
|
96
|
-
link: 'cosy:btn-link',
|
97
|
-
outline: 'cosy:btn-outline',
|
98
|
-
neutral: 'cosy:btn-neutral'
|
99
|
-
};
|
100
|
-
|
101
|
-
// Size classes
|
102
|
-
const sizeClasses = {
|
103
|
-
lg: 'cosy:btn-lg',
|
104
|
-
md: 'cosy:btn-md',
|
105
|
-
sm: 'cosy:btn-sm',
|
106
|
-
xs: 'cosy:btn-xs'
|
107
|
-
};
|
108
|
-
|
109
|
-
// Shape classes
|
110
|
-
const shapeClasses = {
|
111
|
-
circle: 'cosy:btn-circle',
|
112
|
-
square: 'cosy:btn-square'
|
113
|
-
};
|
95
|
+
const classes = ['cosy:btn'];
|
114
96
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
97
|
+
// Variant classes
|
98
|
+
const variantClasses = {
|
99
|
+
primary: 'cosy:btn-primary',
|
100
|
+
secondary: 'cosy:btn-secondary',
|
101
|
+
accent: 'cosy:btn-accent',
|
102
|
+
info: 'cosy:btn-info',
|
103
|
+
success: 'cosy:btn-success',
|
104
|
+
warning: 'cosy:btn-warning',
|
105
|
+
error: 'cosy:btn-error',
|
106
|
+
ghost: 'cosy:btn-ghost',
|
107
|
+
link: 'cosy:btn-link',
|
108
|
+
outline: 'cosy:btn-outline',
|
109
|
+
neutral: 'cosy:btn-neutral',
|
110
|
+
};
|
111
|
+
|
112
|
+
// Size classes
|
113
|
+
const sizeClasses = {
|
114
|
+
lg: 'cosy:btn-lg',
|
115
|
+
md: 'cosy:btn-md',
|
116
|
+
sm: 'cosy:btn-sm',
|
117
|
+
xs: 'cosy:btn-xs',
|
118
|
+
};
|
119
|
+
|
120
|
+
// Shape classes
|
121
|
+
const shapeClasses = {
|
122
|
+
circle: 'cosy:btn-circle',
|
123
|
+
square: 'cosy:btn-square',
|
124
|
+
};
|
125
|
+
|
126
|
+
if (variantClasses[variant]) {
|
127
|
+
classes.push(variantClasses[variant]);
|
128
|
+
}
|
129
|
+
|
130
|
+
if (sizeClasses[size]) {
|
131
|
+
classes.push(sizeClasses[size]);
|
132
|
+
}
|
133
|
+
|
134
|
+
if (shape && shapeClasses[shape]) {
|
135
|
+
classes.push(shapeClasses[shape]);
|
136
|
+
}
|
137
|
+
|
138
|
+
if (wide) classes.push('cosy:btn-wide');
|
139
|
+
if (block) classes.push('cosy:btn-block');
|
140
|
+
if (loading) classes.push('cosy:loading');
|
141
|
+
if (className) classes.push(className);
|
142
|
+
|
143
|
+
return classes;
|
133
144
|
};
|
134
145
|
|
135
146
|
const buttonClasses = getButtonClasses();
|
136
147
|
---
|
137
148
|
|
138
149
|
<button
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
>
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
150
|
+
type={formmethod === 'dialog' ? 'submit' : type}
|
151
|
+
class:list={buttonClasses}
|
152
|
+
disabled={disabled}
|
153
|
+
onclick={onClick}
|
154
|
+
formmethod={formmethod}
|
155
|
+
data-variant={variant}>
|
156
|
+
<span class="cosy:flex cosy:items-center cosy:gap-2">
|
157
|
+
<slot name="icon-left" />
|
158
|
+
<slot />
|
159
|
+
<slot name="icon-right" />
|
160
|
+
</span>
|
161
|
+
</button>
|
162
|
+
|
@@ -47,7 +47,7 @@
|
|
47
47
|
* </Main>
|
48
48
|
* ```
|
49
49
|
*/
|
50
|
-
import '../../
|
50
|
+
import '../../style.ts';
|
51
51
|
import type { IMainContentProps } from '../../index';
|
52
52
|
import Article from '../typography/Article.astro';
|
53
53
|
import TableOfContents from '../navigation/TableOfContents.astro';
|
@@ -1,16 +1,16 @@
|
|
1
1
|
---
|
2
2
|
/**
|
3
3
|
* Section组件
|
4
|
-
*
|
4
|
+
*
|
5
5
|
* 一个用于页面内容区块的组件,支持不同的内边距、背景和间距
|
6
|
-
*
|
6
|
+
*
|
7
7
|
* @example
|
8
8
|
* ```astro
|
9
9
|
* <Section>
|
10
10
|
* <h2>默认区块</h2>
|
11
11
|
* <p>内容将被包裹在一个合适的区块中</p>
|
12
12
|
* </Section>
|
13
|
-
*
|
13
|
+
*
|
14
14
|
* <Section padding="lg" background="gray" centered={true} border={true}>
|
15
15
|
* <h2>自定义区块</h2>
|
16
16
|
* <p>大内边距,灰色背景,内容居中,带边框</p>
|
@@ -20,105 +20,105 @@
|
|
20
20
|
|
21
21
|
import type { HTMLAttributes } from 'astro/types';
|
22
22
|
import Container from './Container.astro';
|
23
|
-
import
|
23
|
+
import '../../style.ts';
|
24
24
|
|
25
25
|
interface Props extends HTMLAttributes<'section'> {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
26
|
+
/**
|
27
|
+
* 内边距大小
|
28
|
+
* @default "md"
|
29
|
+
*/
|
30
|
+
padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
31
|
+
|
32
|
+
/**
|
33
|
+
* 背景颜色
|
34
|
+
* @default "transparent"
|
35
|
+
*/
|
36
|
+
background?: 'transparent' | 'white' | 'gray' | 'primary' | 'secondary' | 'dark';
|
37
|
+
|
38
|
+
/**
|
39
|
+
* 是否使用容器包裹内容
|
40
|
+
* @default true
|
41
|
+
*/
|
42
|
+
container?: boolean;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* 容器尺寸,仅当container为true时有效
|
46
|
+
* @default "md"
|
47
|
+
*/
|
48
|
+
containerSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
49
|
+
|
50
|
+
/**
|
51
|
+
* 内容是否居中
|
52
|
+
* @default false
|
53
|
+
*/
|
54
|
+
centered?: boolean;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* 是否显示边框
|
58
|
+
* @default false
|
59
|
+
*/
|
60
|
+
border?: boolean;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* 自定义类名
|
64
|
+
*/
|
65
|
+
class?: string;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* 类名列表
|
69
|
+
*/
|
70
|
+
'class:list'?: any;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* 自定义ID
|
74
|
+
*/
|
75
|
+
id?: string;
|
76
|
+
|
77
|
+
/**
|
78
|
+
* 自定义内联样式
|
79
|
+
*/
|
80
|
+
style?: string;
|
81
81
|
}
|
82
82
|
|
83
83
|
const {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
84
|
+
padding = 'md',
|
85
|
+
background = 'transparent',
|
86
|
+
container = true,
|
87
|
+
containerSize = 'md',
|
88
|
+
centered = false,
|
89
|
+
border = false,
|
90
|
+
class: className = '',
|
91
|
+
'class:list': classList,
|
92
|
+
id,
|
93
|
+
style,
|
94
|
+
...rest
|
95
95
|
} = Astro.props;
|
96
96
|
|
97
97
|
// 内边距映射
|
98
98
|
const paddingClasses = {
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
none: 'cosy:py-0',
|
100
|
+
sm: 'cosy:py-6',
|
101
|
+
md: 'cosy:py-12',
|
102
|
+
lg: 'cosy:py-16',
|
103
|
+
xl: 'cosy:py-24',
|
104
104
|
};
|
105
105
|
|
106
106
|
// 背景颜色映射
|
107
107
|
const backgroundClasses = {
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
transparent: 'cosy:bg-transparent',
|
109
|
+
white: 'cosy:bg-base-100',
|
110
|
+
gray: 'cosy:bg-base-200',
|
111
|
+
primary: 'cosy:bg-primary/10',
|
112
|
+
secondary: 'cosy:bg-secondary/10',
|
113
|
+
dark: 'cosy:bg-neutral cosy:text-neutral-content',
|
114
114
|
};
|
115
115
|
|
116
116
|
// 构建最终类名
|
117
117
|
const sectionClasses = [
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
paddingClasses[padding as keyof typeof paddingClasses],
|
119
|
+
backgroundClasses[background as keyof typeof backgroundClasses],
|
120
|
+
border ? 'cosy:border cosy:rounded-lg' : '',
|
121
|
+
className,
|
122
122
|
].join(' ');
|
123
123
|
|
124
124
|
// 内容类名
|
@@ -126,13 +126,15 @@ const contentClasses = centered ? 'cosy:text-center' : '';
|
|
126
126
|
---
|
127
127
|
|
128
128
|
<section id={id} class:list={[sectionClasses, classList]} style={style} {...rest}>
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
129
|
+
{
|
130
|
+
container ? (
|
131
|
+
<Container size={containerSize} class={contentClasses}>
|
132
|
+
<slot />
|
133
|
+
</Container>
|
134
|
+
) : (
|
135
|
+
<div class={contentClasses}>
|
136
|
+
<slot />
|
137
|
+
</div>
|
138
|
+
)
|
139
|
+
}
|
138
140
|
</section>
|
@@ -66,10 +66,8 @@
|
|
66
66
|
* ```
|
67
67
|
*/
|
68
68
|
|
69
|
-
import Link from '
|
70
|
-
import
|
71
|
-
import SocialIcon from '../icons/SocialIcon.astro';
|
72
|
-
import '../../app.css';
|
69
|
+
import { SocialIcon, Image, Link } from '../../index';
|
70
|
+
import '../../style.ts';
|
73
71
|
|
74
72
|
// 自定义图片元数据接口,替代 astro 的 ImageMetadata
|
75
73
|
interface CustomImageMetadata {
|
@@ -62,8 +62,8 @@
|
|
62
62
|
* ```
|
63
63
|
*/
|
64
64
|
|
65
|
-
import ProductCard from '
|
66
|
-
import '../../
|
65
|
+
import { ProductCard } from '../../index';
|
66
|
+
import '../../style.ts';
|
67
67
|
import type { Props as ProductCardProps } from './ProductCard.astro';
|
68
68
|
|
69
69
|
// 定义产品项类型
|
@@ -40,10 +40,8 @@
|
|
40
40
|
* ```
|
41
41
|
*/
|
42
42
|
|
43
|
-
import Link from '
|
44
|
-
import
|
45
|
-
import Image from '../base/Image.astro';
|
46
|
-
import '../../app.css';
|
43
|
+
import { SocialIcon, Image, Link } from '../../index';
|
44
|
+
import '../../style.ts';
|
47
45
|
|
48
46
|
interface SocialLink {
|
49
47
|
/**
|
@@ -165,15 +165,11 @@
|
|
165
165
|
* ```
|
166
166
|
*/
|
167
167
|
|
168
|
-
import '../../
|
169
|
-
import BaseLayout from '
|
170
|
-
import Footer from './Footer.astro';
|
168
|
+
import '../../style.ts';
|
169
|
+
import { BaseLayout, type IAppLayoutProps, Footer, Header, Container } from '../../index';
|
171
170
|
import Main from '../containers/Main.astro';
|
172
|
-
import Header from './Header.astro';
|
173
171
|
import Sidebar from './Sidebar.astro';
|
174
172
|
import { ClientRouter } from 'astro:transitions';
|
175
|
-
import type { IAppLayoutProps } from '../../index';
|
176
|
-
import Container from '../containers/Container.astro';
|
177
173
|
|
178
174
|
interface Props extends IAppLayoutProps {}
|
179
175
|
|