From 7e26e9533d46e0890c7c95b31b3ff88faca0d956 Mon Sep 17 00:00:00 2001 From: sanbuphy Date: Tue, 13 Jan 2026 20:32:41 +0800 Subject: [PATCH] feat(docs): add github stars widget and remove social links Add a GitHub stars widget component to display repository stars count with caching Remove social links from config as they're now handled by the new widget Improve font size and line height clamping with null checks --- docs/.vitepress/config.mjs | 6 +- docs/.vitepress/theme/Layout.vue | 4 + .../theme/components/GitHubStars.vue | 100 ++++++++++++++++++ 3 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 docs/.vitepress/theme/components/GitHubStars.vue diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index 50d3564..bc8c444 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -15,9 +15,9 @@ const commonThemeConfig = { search: { provider: 'local' }, - socialLinks: [ - { icon: 'github', link: 'https://github.com/datawhalechina/easy-vibe' } - ], + // socialLinks: [ + // { icon: 'github', link: 'https://github.com/datawhalechina/easy-vibe' } + // ], outline: { level: [1, 6] } diff --git a/docs/.vitepress/theme/Layout.vue b/docs/.vitepress/theme/Layout.vue index 87feedd..d68beb7 100644 --- a/docs/.vitepress/theme/Layout.vue +++ b/docs/.vitepress/theme/Layout.vue @@ -2,6 +2,7 @@ import DefaultTheme from 'vitepress/theme' import { useData } from 'vitepress' import TextType from './components/TextType.vue' +import GitHubStars from './components/GitHubStars.vue' import { onMounted, ref, watch } from 'vue' import { Setting } from '@element-plus/icons-vue' @@ -29,12 +30,14 @@ const lineHeight = ref(DEFAULT_LINE_HEIGHT) const isHydrated = ref(false) const clampFontSize = (value) => { + if (value === null || value === undefined || value === '') return DEFAULT_FONT_SIZE const numeric = Number(value) if (!Number.isFinite(numeric)) return DEFAULT_FONT_SIZE return Math.min(MAX_FONT_SIZE, Math.max(MIN_FONT_SIZE, numeric)) } const clampLineHeight = (value) => { + if (value === null || value === undefined || value === '') return DEFAULT_LINE_HEIGHT const numeric = Number(value) if (!Number.isFinite(numeric)) return DEFAULT_LINE_HEIGHT return Math.min(MAX_LINE_HEIGHT, Math.max(MIN_LINE_HEIGHT, numeric)) @@ -94,6 +97,7 @@ watch(lineHeight, (next) => {