Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): add contributors & enhance AddonGallery components #449

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/.valaxy/typed-router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ declare module 'vue-router/auto-routes' {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/[...all]': RouteRecordInfo<'/[...all]', '/:all(.*)', { all: ParamValue<true> }, { all: ParamValue<false> }>,
'/[...path]': RouteRecordInfo<'/[...path]', '/:path(.*)', { path: ParamValue<true> }, { path: ParamValue<false> }>,
'/addons/': RouteRecordInfo<'/addons/', '/addons', Record<never, never>, Record<never, never>>,
'/addons/gallery': RouteRecordInfo<'/addons/gallery', '/addons/gallery', Record<never, never>, Record<never, never>>,
'/addons/use': RouteRecordInfo<'/addons/use', '/addons/use', Record<never, never>, Record<never, never>>,
'/addons/why': RouteRecordInfo<'/addons/why', '/addons/why', Record<never, never>, Record<never, never>>,
Expand All @@ -29,16 +30,19 @@ declare module 'vue-router/auto-routes' {
'/dev/docs': RouteRecordInfo<'/dev/docs', '/dev/docs', Record<never, never>, Record<never, never>>,
'/dev/faq': RouteRecordInfo<'/dev/faq', '/dev/faq', Record<never, never>, Record<never, never>>,
'/dev/logo': RouteRecordInfo<'/dev/logo', '/dev/logo', Record<never, never>, Record<never, never>>,
'/ecosystem/': RouteRecordInfo<'/ecosystem/', '/ecosystem', Record<never, never>, Record<never, never>>,
'/ecosystem/client': RouteRecordInfo<'/ecosystem/client', '/ecosystem/client', Record<never, never>, Record<never, never>>,
'/ecosystem/community': RouteRecordInfo<'/ecosystem/community', '/ecosystem/community', Record<never, never>, Record<never, never>>,
'/ecosystem/news': RouteRecordInfo<'/ecosystem/news', '/ecosystem/news', Record<never, never>, Record<never, never>>,
'/ecosystem/vscode': RouteRecordInfo<'/ecosystem/vscode', '/ecosystem/vscode', Record<never, never>, Record<never, never>>,
'/examples/': RouteRecordInfo<'/examples/', '/examples', Record<never, never>, Record<never, never>>,
'/examples/code-height-limit': RouteRecordInfo<'/examples/code-height-limit', '/examples/code-height-limit', Record<never, never>, Record<never, never>>,
'/examples/katex': RouteRecordInfo<'/examples/katex', '/examples/katex', Record<never, never>, Record<never, never>>,
'/examples/mermaid': RouteRecordInfo<'/examples/mermaid', '/examples/mermaid', Record<never, never>, Record<never, never>>,
'/examples/partial-content-encryption': RouteRecordInfo<'/examples/partial-content-encryption', '/examples/partial-content-encryption', Record<never, never>, Record<never, never>>,
'/examples/site': RouteRecordInfo<'/examples/site', '/examples/site', Record<never, never>, Record<never, never>>,
'/faq/': RouteRecordInfo<'/faq/', '/faq', Record<never, never>, Record<never, never>>,
'/guide/': RouteRecordInfo<'/guide/', '/guide', Record<never, never>, Record<never, never>>,
'/guide/best-pratice': RouteRecordInfo<'/guide/best-pratice', '/guide/best-pratice', Record<never, never>, Record<never, never>>,
'/guide/built-ins/': RouteRecordInfo<'/guide/built-ins/', '/guide/built-ins', Record<never, never>, Record<never, never>>,
'/guide/commands/': RouteRecordInfo<'/guide/commands/', '/guide/commands', Record<never, never>, Record<never, never>>,
Expand All @@ -65,6 +69,7 @@ declare module 'vue-router/auto-routes' {
'/migration/': RouteRecordInfo<'/migration/', '/migration', Record<never, never>, Record<never, never>>,
'/migration/hexo': RouteRecordInfo<'/migration/hexo', '/migration/hexo', Record<never, never>, Record<never, never>>,
'/posts/i18n': RouteRecordInfo<'/posts/i18n', '/posts/i18n', Record<never, never>, Record<never, never>>,
'/themes/': RouteRecordInfo<'/themes/', '/themes', Record<never, never>, Record<never, never>>,
'/themes/gallery': RouteRecordInfo<'/themes/gallery', '/themes/gallery', Record<never, never>, Record<never, never>>,
'/themes/use': RouteRecordInfo<'/themes/use', '/themes/use', Record<never, never>, Record<never, never>>,
'/themes/write': RouteRecordInfo<'/themes/write', '/themes/write', Record<never, never>, Record<never, never>>,
Expand Down
18 changes: 14 additions & 4 deletions docs/components/AddonGallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n'
export interface ValaxyAddon {
icon: string
name: string
author: string | string[]
repo: string
desc: string
desc_zh: string
Expand All @@ -20,10 +21,19 @@ const props = withDefaults(defineProps<{
const { t } = useI18n()
const keyword = ref('')
const filteredAddons = computed(() => {
return props.addons.filter((item) => {
return item.name.includes(keyword.value) || item.tags?.some(t => t.includes(keyword.value))
})
return props.addons
.filter(item => item.name.includes(keyword.value) || item.tags?.some(t => t.includes(keyword.value)))
.map((item) => {
if (typeof item.author === 'string')
return { ...item, author: [item.author] }
return item
})
})
function handleTagClick(tag: string) {
keyword.value = tag
}
</script>

<template>
Expand All @@ -42,7 +52,7 @@ const filteredAddons = computed(() => {
</div>
<ul class="m-0! p-0! sm:grid-cols-1 lg:grid-cols-2 grid" gap="4">
<li v-for="addon, i in filteredAddons" :key="i" class="w-full list-none m-0!">
<AddonGalleryCard :addon="addon" />
<AddonGalleryCard :addon="addon" @tag-click="handleTagClick" />
</li>
</ul>
</template>
15 changes: 14 additions & 1 deletion docs/components/AddonGalleryCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import type { ValaxyAddon } from './AddonGallery.vue'
defineProps<{
addon: ValaxyAddon
}>()
const emit = defineEmits(['tagClick'])
function handleTagClick(tag: string) {
emit('tagClick', tag)
}
</script>

<template>
Expand All @@ -18,6 +24,13 @@ defineProps<{
<span>{{ addon.name }}</span>
</h3>
</a>
<p v-if="addon.author" class="my-2! text-sm" op="70">
By
<span v-for="(author, index) in addon.author" :key="index">
<a class="text-dark-200!" :href="`https://github.com/${author}`" target="_blank">{{ author }}</a>
<span v-if="index < addon.author.length - 1">, </span>
</span>
</p>
<p class="my-1! text-xl!">
<a mr-2 class="text-red-600!" :href="`https://npmjs.com/package/${addon.name}`" target="_blank" alt="NPM Package">
<div i-ri-npmjs-line />
Expand All @@ -41,7 +54,7 @@ defineProps<{
<span inline-flex mr-1>
<div :class="addon.icon" />
</span>
<span v-for="tag, j in addon.tags" :key="j" class="break-all mr-1">
<span v-for="tag, j in addon.tags" :key="j" class="break-all mr-1 cursor-pointer" @click="handleTagClick(tag)">
#{{ tag }}
</span>
</ul>
Expand Down
23 changes: 23 additions & 0 deletions docs/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
</script>

<template>
<Layout>
<RouterView v-slot="{ Component }">
<component :is="Component">
<template #default>
<div class="prose mx-auto w-full max-w-4xl">
<h2 :id="t('post.contributors')">
<a :href="`#${t('post.contributors')}`" class="header-anchor" />
{{ t('post.contributors') }}
</h2>
<GitLogContributor />
</div>
</template>
</component>
</RouterView>
</Layout>
</template>
3 changes: 3 additions & 0 deletions docs/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ toc:
base-config: Base Config
extend-config: Extend Config
unocss-options: UnoCSS Options

post:
contributors: Contributors
3 changes: 3 additions & 0 deletions docs/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ toc:
base-config: 基础配置
extend-config: 扩展配置
unocss-options: UnoCSS 配置

post:
contributors: 贡献者
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"valaxy": "link:../packages/valaxy",
"valaxy-addon-algolia": "link:../packages/valaxy-addon-algolia",
"valaxy-addon-components": "workspace:*",
"valaxy-addon-git-log": "^0.1.0",
"valaxy-theme-press": "link:../packages/valaxy-theme-press"
},
"devDependencies": {
Expand Down
37 changes: 37 additions & 0 deletions docs/pages/addons/gallery.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,98 @@ end: false

addons:
- name: valaxy-addon-algolia
author: YunYouJun
icon: i-ri-search-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-algolia
desc: Algolia Search.
desc_zh: Algolia 搜索
tags:
- search
- name: valaxy-addon-components
author: YunYouJun
icon: i-ri-apps-2-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-components
desc: Common Components for Valaxy.
desc_zh: Valaxy 的通用组件
tags:
- component
- name: valaxy-addon-lightgallery
author: YunYouJun
icon: i-ri-image-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-lightgallery
desc: LightGallery for Valaxy.
desc_zh: Valaxy 的 LightGallery
tags:
- image
- name: valaxy-addon-waline
author: YunYouJun
icon: i-ri-chat-3-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-waline
desc: Waline comment.
desc_zh: Waline 评论系统
tags:
- comment
- name: valaxy-addon-twikoo
author: YunYouJun
icon: i-ri-chat-3-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-twikoo
desc: Twikoo comment.
desc_zh: Twikoo 评论系统
tags:
- comment
- name: valaxy-addon-bangumi
author:
- yixiaojiu
- YunYouJun
icon: i-ri-film-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-bangumi
desc: Display bilibili or bangumi watching list.
desc_zh: 展示 bilibili 或 bangumi 追番列表
tags:
- video
- name: valaxy-addon-meting
author:
- YunYouJun
- yixiaojiu
icon: i-ri-music-2-line
repo: https://github.com/YunYouJun/valaxy/tree/main/packages/valaxy-addon-meting
desc: Global music player based on APlayer and MetingJS.
desc_zh: 基于 APlayer 和 MetingJS 的全局音乐播放器
tags:
- music
- name: valaxy-addon-live2d
author: WRXinYue
icon: i-ri-magic-line
repo: https://github.com/valaxyjs/valaxy-addon-live2d
desc: Cute live2d mascot component.
desc_zh: 萌萌哒 live2d 看板娘组件
tags:
- magic
- name: valaxy-addon-git-log
author: WRXinYue
icon: i-ri-git-pull-request-line
repo: https://github.com/valaxyjs/valaxy-addon-git-log
desc: Integrates git logs into your page of Valaxy site.
desc_zh: 将 Git 日志集成到你的 Valaxy 网站页面中
tags:
- git-log
- name: valaxy-addon-hitokoto
author: WRXinYue
icon: i-ri-chat-quote-line
repo: https://github.com/valaxyjs/valaxy-addon-hitokoto
desc: Hitokoto Composition API for Valaxy.
desc_zh: 将一言(Hitokoto)API 集成于 Valaxy
tags:
- hitokoto
- name: valaxy-addon-vercount
author: WRXinYue
icon: i-ri-eye-line
repo: https://github.com/valaxyjs/valaxy-addon-vercount
desc: A Vercount API based counting plugin for Valaxy, serving as an alternative to Busuanzi counting.
desc_zh: 基于 Vercount API 实现的 Valaxy 计数插件, 用于不蒜子计数替代方案
tags:
- busuanzi
- vercount
---

<AddonGallery :addons="$frontmatter.addons" />
Empty file added docs/pages/addons/index.md
Empty file.
Empty file added docs/pages/ecosystem/index.md
Empty file.
Empty file added docs/pages/examples/index.md
Empty file.
Empty file added docs/pages/guide/index.md
Empty file.
Empty file added docs/pages/themes/index.md
Empty file.
4 changes: 4 additions & 0 deletions docs/valaxy.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineValaxyConfig } from 'valaxy'
import type { PressTheme } from 'valaxy-theme-press'
import { addonAlgolia } from 'valaxy-addon-algolia'
import { addonComponents } from 'valaxy-addon-components'
import { addonGitLog } from 'valaxy-addon-git-log'

const COMMIT_ID = process.env.CF_PAGES_COMMIT_SHA || process.env.COMMIT_REF
const commitRef = COMMIT_ID?.slice(0, 8) || 'dev'
Expand Down Expand Up @@ -39,6 +40,9 @@ export default defineValaxyConfig<PressTheme.Config>({
indexName: 'valaxysite',
}),
addonComponents(),
addonGitLog({
repositoryUrl: 'https://github.com/YunYouJun/valaxy.git',
}),
],

theme: 'press',
Expand Down
Loading
Loading