From cc3805425e87c86ffef0ca1d7c3c7ed88edadedf Mon Sep 17 00:00:00 2001 From: zkz098 Date: Sat, 11 Nov 2023 14:37:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E7=AB=A0=E5=BA=95=E9=83=A8?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 46 ++++++++++++------------ theme/components/ShokaxPostCopyright.vue | 7 ++-- theme/components/ShokaxPostFooter.vue | 25 +++++++++++++ theme/components/ShokaxPostNav.vue | 17 +++++++++ theme/components/ShokaxPostNavBlock.vue | 38 ++++++++++++++++++++ theme/composables/config.ts | 9 +++++ theme/node/index.ts | 3 ++ theme/types/index.d.ts | 2 ++ 8 files changed, 122 insertions(+), 25 deletions(-) create mode 100644 theme/components/ShokaxPostFooter.vue create mode 100644 theme/components/ShokaxPostNav.vue create mode 100644 theme/components/ShokaxPostNavBlock.vue diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67fcc23..5c789cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,33 +43,33 @@ jobs: # run: pnpm run typecheck # check windows build - build: - runs-on: ${{ matrix.os }} + # build: + # runs-on: ${{ matrix.os }} - strategy: - matrix: - node-version: [16.x] - os: [ubuntu-latest, windows-latest] - fail-fast: false + # strategy: + # matrix: + # node-version: [16.x] + # os: [ubuntu-latest, windows-latest] + # fail-fast: false - steps: - - uses: actions/checkout@v3 + # steps: + # - uses: actions/checkout@v3 - - name: Install pnpm - uses: pnpm/action-setup@v2 + # - name: Install pnpm + # uses: pnpm/action-setup@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - registry-url: https://registry.npmjs.org/ - cache: pnpm + # - name: Use Node.js ${{ matrix.node-version }} + # uses: actions/setup-node@v3 + # with: + # node-version: ${{ matrix.node-version }} + # registry-url: https://registry.npmjs.org/ + # cache: pnpm - - name: Install - run: pnpm install + # - name: Install + # run: pnpm install - - name: Build - run: pnpm run build + # - name: Build + # run: pnpm run build - - name: Build:demo - run: pnpm run build:demo + # - name: Build:demo + # run: pnpm run build:demo diff --git a/theme/components/ShokaxPostCopyright.vue b/theme/components/ShokaxPostCopyright.vue index 504ed85..58ce254 100644 --- a/theme/components/ShokaxPostCopyright.vue +++ b/theme/components/ShokaxPostCopyright.vue @@ -1,11 +1,14 @@ diff --git a/theme/components/ShokaxPostFooter.vue b/theme/components/ShokaxPostFooter.vue new file mode 100644 index 0000000..0d726d2 --- /dev/null +++ b/theme/components/ShokaxPostFooter.vue @@ -0,0 +1,25 @@ + + + diff --git a/theme/components/ShokaxPostNav.vue b/theme/components/ShokaxPostNav.vue new file mode 100644 index 0000000..d75f438 --- /dev/null +++ b/theme/components/ShokaxPostNav.vue @@ -0,0 +1,17 @@ + + + diff --git a/theme/components/ShokaxPostNavBlock.vue b/theme/components/ShokaxPostNavBlock.vue new file mode 100644 index 0000000..f595780 --- /dev/null +++ b/theme/components/ShokaxPostNavBlock.vue @@ -0,0 +1,38 @@ + + + diff --git a/theme/composables/config.ts b/theme/composables/config.ts index 93145d7..fc4ff0b 100644 --- a/theme/composables/config.ts +++ b/theme/composables/config.ts @@ -1,4 +1,5 @@ import { computed } from 'vue' +import type { Post } from 'valaxy' import { useConfig } from 'valaxy' import type { ThemeConfig } from '../types' @@ -9,3 +10,11 @@ export function useThemeConfig() { const config = useConfig() return computed(() => config!.value.themeConfig) } + +export function getCover(post: Post) { + const covers = useConfig().value.themeConfig.covers + if (post.cover) + return post.cover + else if (covers.length >= 1) + return covers[0] +} diff --git a/theme/node/index.ts b/theme/node/index.ts index a74b6a2..f112b25 100644 --- a/theme/node/index.ts +++ b/theme/node/index.ts @@ -35,6 +35,9 @@ export const defaultThemeConfig: ThemeConfig = { atom: false, }, author: 'Anyone', + covers: [ + 'https://example.com', + ], } // write a vite plugin diff --git a/theme/types/index.d.ts b/theme/types/index.d.ts index 0cbc726..d8c0172 100644 --- a/theme/types/index.d.ts +++ b/theme/types/index.d.ts @@ -71,6 +71,8 @@ export interface ThemeConfig { rss: boolean atom: boolean } + + covers: string[] } export interface NavItem {