Skip to content

Commit 674db45

Browse files
committed
update playground
1 parent 6be0e22 commit 674db45

File tree

5 files changed

+52
-9
lines changed

5 files changed

+52
-9
lines changed

playground/docus/app/pages/authors.vue

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,39 @@ const { data: authors } = await useAsyncData('authors-list', () => queryCollecti
88
<div>
99
<UContainer>
1010
<ContentRenderer :value="page" />
11+
<div class="flex flex-col gap-2">
12+
<UUser
13+
v-for="author in authors"
14+
:key="author.name"
15+
:name="author.name"
16+
:description="author.username ? `@${author.username}` : ''"
17+
:avatar="author.avatar"
18+
:to="author.to"
19+
>
20+
<template #name>
21+
<div class="flex gap-2">
22+
<span class="text-sm font-medium">{{ author.name }}</span>
23+
<span class="text-sm text-muted">
24+
- {{ author.username ? `@${author.username}` : '' }}
25+
</span>
26+
</div>
27+
</template>
1128

12-
<UUser
13-
v-for="author in authors"
14-
:key="author.name"
15-
:name="author.name"
16-
:description="author.username ? `@${author.username}` : ''"
17-
:avatar="author.avatar"
18-
:to="author.to"
19-
/>
29+
<template #description>
30+
<div class="flex gap-2">
31+
<UBadge
32+
v-for="module in author.modules"
33+
:key="module"
34+
variant="soft"
35+
size="xs"
36+
color="neutral"
37+
>
38+
{{ module }}
39+
</UBadge>
40+
</div>
41+
</template>
42+
</UUser>
43+
</div>
2044
</UContainer>
2145
</div>
2246
</template>

playground/docus/content.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const createAuthorsSchema = () => z.object({
1919
}),
2020
to: z.string(),
2121
username: z.string(),
22+
modules: z.array(z.string()),
2223
})
2324

2425
const collections: Record<string, DefinedCollection> = {

playground/docus/content/3.pages/authors.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ pages: defineCollection({
2121

2222
## Authors list
2323

24-
Fetch from data collection:
24+
Fetch from data collection
25+
26+
```[content.config.ts]
27+
authors: defineCollection({
28+
type: 'data',
29+
source: {
30+
include: 'authors/**/*',
31+
},
32+
schema: createAuthorsSchema(),
33+
}),
34+
```

playground/docus/content/authors/atinux.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ avatar:
33
src: https://avatars.githubusercontent.com/u/904724?v=4
44
to: https://x.com/atinux
55
username: atinux
6+
modules:
7+
- hub
8+
- ui
9+
- auth

playground/docus/content/authors/farnabaz.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ avatar:
44
src: https://avatars.githubusercontent.com/u/2047945?v=4
55
to: https://x.com/farnabaz
66
username: farnabaz
7+
modules:
8+
- studio
9+
- content
10+
- mdc
711
---

0 commit comments

Comments
 (0)