@coffic/cosy-ui 1.0.12 → 1.0.13
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.
|
@@ -155,6 +155,12 @@ export interface Props {
|
|
|
155
155
|
* GitHub按钮文本
|
|
156
156
|
*/
|
|
157
157
|
githubButtonText?: string;
|
|
158
|
+
/**
|
|
159
|
+
* 语言设置,影响默认按钮文本
|
|
160
|
+
* - zh-cn: 中文默认(访问官网)
|
|
161
|
+
* - en: 英文默认(Visit Website)
|
|
162
|
+
*/
|
|
163
|
+
lang?: string;
|
|
158
164
|
/**
|
|
159
165
|
* 按钮布局方向
|
|
160
166
|
* - row: 水平布局(默认)
|
|
@@ -203,7 +209,7 @@ const {
|
|
|
203
209
|
productUrl,
|
|
204
210
|
githubUrl,
|
|
205
211
|
size = 'md',
|
|
206
|
-
primaryButtonText
|
|
212
|
+
primaryButtonText,
|
|
207
213
|
secondaryButtonText = 'App Store',
|
|
208
214
|
githubButtonText = 'GitHub',
|
|
209
215
|
buttonLayout = 'row',
|
|
@@ -213,8 +219,12 @@ const {
|
|
|
213
219
|
shadow = 'md',
|
|
214
220
|
background,
|
|
215
221
|
muted = false,
|
|
222
|
+
lang,
|
|
216
223
|
} = Astro.props;
|
|
217
224
|
|
|
225
|
+
const effectivePrimaryButtonText =
|
|
226
|
+
primaryButtonText ?? (lang === 'en' ? 'Visit Website' : '访问官网');
|
|
227
|
+
|
|
218
228
|
// 尺寸样式映射
|
|
219
229
|
const sizeStyles = {
|
|
220
230
|
xs: {
|
|
@@ -401,7 +411,7 @@ const buttonsContainerClass =
|
|
|
401
411
|
<span slot="icon-left">
|
|
402
412
|
<LinkIcon size="22px" />
|
|
403
413
|
</span>
|
|
404
|
-
{
|
|
414
|
+
{effectivePrimaryButtonText}
|
|
405
415
|
</Button>
|
|
406
416
|
)
|
|
407
417
|
}
|
|
@@ -164,6 +164,12 @@ export interface Props {
|
|
|
164
164
|
* 控制网格布局中所有卡片是否居中显示
|
|
165
165
|
*/
|
|
166
166
|
centerItems?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* 语言设置,传递给 ProductCard 用于默认按钮文本
|
|
169
|
+
* - zh-cn: 中文(访问官网)
|
|
170
|
+
* - en: 英文(Visit Website)
|
|
171
|
+
*/
|
|
172
|
+
lang?: string;
|
|
167
173
|
/**
|
|
168
174
|
* 自定义类名
|
|
169
175
|
*/
|
|
@@ -181,6 +187,7 @@ const {
|
|
|
181
187
|
showBorder = false,
|
|
182
188
|
margin = 'md',
|
|
183
189
|
centerItems = true,
|
|
190
|
+
lang,
|
|
184
191
|
class: className = '',
|
|
185
192
|
} = Astro.props;
|
|
186
193
|
|
|
@@ -255,6 +262,7 @@ const containerClasses = [
|
|
|
255
262
|
size={cardSize}
|
|
256
263
|
equalHeight={equalHeight}
|
|
257
264
|
descriptionLines={descriptionLines}
|
|
265
|
+
lang={lang ?? product.lang}
|
|
258
266
|
/>
|
|
259
267
|
))
|
|
260
268
|
}
|
|
@@ -61,6 +61,12 @@ interface Props {
|
|
|
61
61
|
* GitHub按钮文本
|
|
62
62
|
*/
|
|
63
63
|
githubButtonText?: string;
|
|
64
|
+
/**
|
|
65
|
+
* 语言设置,影响默认按钮文本
|
|
66
|
+
* - zh-cn: 中文默认(访问官网)
|
|
67
|
+
* - en: 英文默认(Visit Website)
|
|
68
|
+
*/
|
|
69
|
+
lang?: string;
|
|
64
70
|
/**
|
|
65
71
|
* 按钮布局方向
|
|
66
72
|
* - row: 水平布局(默认)
|
|
@@ -103,7 +109,7 @@ interface Props {
|
|
|
103
109
|
|
|
104
110
|
const props = withDefaults(defineProps<Props>(), {
|
|
105
111
|
size: "md",
|
|
106
|
-
primaryButtonText:
|
|
112
|
+
primaryButtonText: undefined,
|
|
107
113
|
secondaryButtonText: "App Store",
|
|
108
114
|
githubButtonText: "GitHub",
|
|
109
115
|
buttonLayout: "row",
|
|
@@ -118,6 +124,12 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
118
124
|
githubUrl: undefined,
|
|
119
125
|
});
|
|
120
126
|
|
|
127
|
+
const effectivePrimaryButtonText = computed(
|
|
128
|
+
() =>
|
|
129
|
+
props.primaryButtonText ??
|
|
130
|
+
(props.lang === "en" ? "Visit Website" : "访问官网"),
|
|
131
|
+
);
|
|
132
|
+
|
|
121
133
|
// 尺寸样式映射
|
|
122
134
|
const sizeStyles = {
|
|
123
135
|
xs: {
|
|
@@ -320,7 +332,7 @@ const description = computed(() => props.description);
|
|
|
320
332
|
">
|
|
321
333
|
<LinkIcon class="cosy:w-4 cosy:h-4" />
|
|
322
334
|
<a :href="productUrl" target="_blank" rel="noopener noreferrer">
|
|
323
|
-
{{
|
|
335
|
+
{{ effectivePrimaryButtonText }}
|
|
324
336
|
</a>
|
|
325
337
|
</Button>
|
|
326
338
|
|