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
This commit is contained in:
sanbuphy
2026-01-13 20:32:41 +08:00
parent 27d14a4bcc
commit 7e26e9533d
3 changed files with 107 additions and 3 deletions
+4
View File
@@ -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) => {
<template>
<DefaultTheme.Layout>
<template #nav-bar-content-after>
<GitHubStars />
<ClientOnly>
<el-popover placement="bottom-end" trigger="click" :width="260">
<template #reference>