Skip to content

Commit 91eb4d1

Browse files
authored
Merge pull request #83 from UIGF-org/82-导入导出支持badge分离
2 parents 62f6d67 + 85e1d5b commit 91eb4d1

File tree

5 files changed

+440
-187
lines changed

5 files changed

+440
-187
lines changed

README.md

+36-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@
3434
repo=""
3535
site=""
3636
title=""
37-
desc="">
38-
<Pcb label="UIGF vx.x" :games="['ys', 'sr', 'zzz_']" bg=""></Pcb>
39-
<Pcb bg="">Text</Pcb>
37+
desc=""
38+
import export>
39+
<template #import>
40+
<Pcb label="UIGF vx.x" :games="['ys', 'sr', 'zzz_']" bg=""></Pcb>
41+
<Pcb bg="">Text</Pcb>
42+
</template>
43+
<template #export>
44+
<Pcb label="UIGF vx.x" :games="['ys', 'sr', 'zzz_']" bg=""></Pcb>
45+
<Pcb bg="">Text</Pcb>
46+
</template>
4047
</Pcd>
4148
```
4249

@@ -52,6 +59,32 @@
5259
- 项目支持 UIGF v2.2,应填写 `label="UIGF v2.2" :games="['ys']"`
5360
- 若有追加说明,可使用 `<Pcb>Text</Pcb>` 标签,其中 `Text` 为你的说明文字
5461
- **`bg`**: 可选字段,你的说明文字的背景颜色,可选值为 `red`, `blue`, `green`, `yellow`, `purple`,`white`
62+
- **`import`****`export`****必填填写字段**,对项目导入和导出的支持情况进行说明
63+
64+
- 示例代码:
65+
66+
```html
67+
<!-- 项目支持UIGFv2.4~4.0的导入,但仅支持UIGF3.0 4.0的导出 -->
68+
<Pcd
69+
bg="/partnerships/TeyvatGuide/AppPreview.png"
70+
icon="/partnerships/TeyvatGuide/logo.png"
71+
repo="https://github.com/BTMuli/TeyvatGuide"
72+
site="https://apps.microsoft.com/detail/9NLBNNNBNSJN"
73+
title="提瓦特指南"
74+
desc="Game Tool for Genshin Impact Player"
75+
import export>
76+
<template #import>
77+
<Pcb label="UIGF v4.0" :games="['ys', 'sr_', 'zzz_']" bg="orange"></Pcb>
78+
<Pcb label="UIGF v3.0" :games="['ys']" bg="white"></Pcb>
79+
<Pcb label="UIGF v2.4" :games="['ys']" bg="white"></Pcb>
80+
<Pcb label="UIGF v2.3" :games="['ys']" bg="white"></Pcb>
81+
</template>
82+
<template #export>
83+
<Pcb label="UIGF v4.0" :games="['ys', 'sr_', 'zzz_']" bg="orange"></Pcb>
84+
<Pcb label="UIGF v3.0" :games="['ys']" bg="white"></Pcb>
85+
</template>
86+
</Pcd>
87+
```
5588

5689
- 若您的项目
5790
- 支持 UIGF v4.0或以上版本

docs/.vuepress/components/ProjCardDev.vue

+53-4
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,32 @@
1111
<div class="proj-card-main">
1212
<img :src="props.icon" alt="icon" />
1313
<div class="proj-card-info">
14-
<div class="proj-card-title" :title="props.title">{{ props.title }}</div>
14+
<div class="proj-card-title" :title="props.title" @click="toProj()">
15+
{{ props.title }}
16+
</div>
1517
<div class="proj-card-desc" :title="props.desc">{{ props.desc }}</div>
1618
</div>
1719
</div>
18-
<div class="proj-card-badges">
20+
<div v-if="props.import" class="proj-card-badge-box">
21+
<div class="proj-card-badge-title">{{ getImportTitle() }}</div>
22+
<div class="proj-card-badges">
23+
<slot name="import"></slot>
24+
</div>
25+
</div>
26+
<div v-if="props.export" class="proj-card-badge-box">
27+
<div class="proj-card-badge-title">{{ getExportTitle() }}</div>
28+
<div class="proj-card-badges">
29+
<slot name="export"></slot>
30+
</div>
31+
</div>
32+
<div class="proj-card-badges" v-if="!props.export && !props.import">
1933
<slot></slot>
2034
</div>
2135
</div>
2236
</div>
2337
</template>
2438
<script lang="ts" setup>
25-
import { computed } from "vue";
39+
import { computed, onMounted, ref } from "vue";
2640
import { useLocalStorage } from "@vueuse/core";
2741
2842
interface ProjCardDevProps {
@@ -32,9 +46,25 @@ interface ProjCardDevProps {
3246
desc: string;
3347
repo?: string;
3448
site?: string;
49+
import?: true;
50+
export?: true;
3551
}
3652
3753
const props = defineProps<ProjCardDevProps>();
54+
const lang = ref("zh-CN");
55+
56+
onMounted(() => {
57+
const path = window.location.pathname;
58+
lang.value = path.startsWith("/zh/") ? "zh-CN" : "en-US";
59+
});
60+
61+
function getImportTitle() {
62+
return lang.value === "zh-CN" ? "导入支持:" : "Supported Import:";
63+
}
64+
65+
function getExportTitle() {
66+
return lang.value === "zh-CN" ? "导出支持:" : "Supported Export:";
67+
}
3868
3969
function isDarkTheme(): boolean | null {
4070
const theme = useLocalStorage<"auto" | "dark" | "light">("vuepress-theme-hope-scheme", "auto");
@@ -62,6 +92,10 @@ function toRepo() {
6292
function toSite() {
6393
window.open(props.site, "_blank");
6494
}
95+
96+
function toProj() {
97+
window.open(props.site || props.repo, "_blank");
98+
}
6599
</script>
66100
<style lang="css" scoped>
67101
.proj-card-dev {
@@ -74,6 +108,7 @@ function toSite() {
74108
display: flex;
75109
flex-direction: column;
76110
background: v-bind(contentBg);
111+
margin-bottom: 1.2em;
77112
}
78113
79114
.proj-card-bg {
@@ -114,7 +149,7 @@ function toSite() {
114149
}
115150
116151
i:hover {
117-
color: var(--theme-color)
152+
color: var(--theme-color);
118153
}
119154
}
120155
@@ -154,6 +189,20 @@ function toSite() {
154189
.proj-card-title {
155190
font-size: 1.5em;
156191
font-weight: bold;
192+
cursor: pointer;
193+
}
194+
195+
.proj-card-badge-box {
196+
display: flex;
197+
flex-direction: column;
198+
align-items: flex-start;
199+
justify-content: flex-start;
200+
gap: 0.5em;
201+
}
202+
203+
.proj-card-badge-title {
204+
font-size: 1.2em;
205+
font-weight: bold;
157206
}
158207
159208
.proj-card-badges {

docs/.vuepress/components/RelativeProjectPanel.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { onMounted } from "vue";
33
import { useLocalStorage } from "@vueuse/core";
44
5-
65
const theme = useLocalStorage<"auto" | "dark" | "light">("vuepress-theme-hope-scheme", "auto");
76
87
onMounted(() => {
@@ -12,7 +11,6 @@ onMounted(() => {
1211
}
1312
});
1413
});
15-
1614
</script>
1715

1816
<template>
@@ -23,11 +21,10 @@ onMounted(() => {
2321

2422
<style scoped lang="scss">
2523
.relative-project-panel {
26-
display: grid;
24+
column-count: 2;
2725
gap: 1.2em;
28-
grid-template-columns: repeat(2, 1fr);
2926
@media (max-width: 768px) {
30-
grid-template-columns: 1fr;
27+
column-count: 1;
3128
}
3229
}
3330
</style>

0 commit comments

Comments
 (0)