From 57c662aa2fd99406e13eb824e943fd21dfd05a29 Mon Sep 17 00:00:00 2001 From: sanbuphy Date: Mon, 16 Mar 2026 00:26:59 +0800 Subject: [PATCH] style(theme): enhance visual design and mobile responsiveness --- .../theme/components/ArticleCard.vue | 45 +++++++----- .../theme/components/ArticleGrid.vue | 13 +++- .../theme/components/CategoryIndex.vue | 31 +++++++-- .../theme/components/HomeFeatures.vue | 59 +++++++++++++++- docs/.vitepress/theme/components/NavCard.vue | 69 ++++++++++++++----- docs/.vitepress/theme/components/NavGrid.vue | 14 +++- docs/public/sitemap.xml | 14 ++-- 7 files changed, 190 insertions(+), 55 deletions(-) diff --git a/docs/.vitepress/theme/components/ArticleCard.vue b/docs/.vitepress/theme/components/ArticleCard.vue index e0ed1f9..d8113ff 100644 --- a/docs/.vitepress/theme/components/ArticleCard.vue +++ b/docs/.vitepress/theme/components/ArticleCard.vue @@ -36,20 +36,27 @@ defineProps({ .article-card { display: flex; justify-content: space-between; - align-items: center; - background-color: var(--vp-c-bg-soft); - border: 1px solid var(--vp-c-divider); - border-radius: 8px; - padding: 16px; + align-items: flex-start; + background: + radial-gradient(circle at 100% -10%, color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent), transparent 42%), + linear-gradient(160deg, color-mix(in srgb, var(--vp-c-brand-1) 6%, var(--vp-c-bg-soft)) 0%, var(--vp-c-bg-soft) 100%); + border: 1px solid color-mix(in srgb, var(--vp-c-brand-1) 10%, var(--vp-c-divider)); + border-radius: 20px; + padding: 18px 20px; text-decoration: none; - transition: all 0.2s; + transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease; height: 100%; + backdrop-filter: blur(8px); } .article-card:hover { border-color: var(--vp-c-brand); - transform: translateY(-2px); - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); + transform: translateY(-4px) scale(1.01); + box-shadow: 0 18px 40px rgba(0, 113, 227, 0.12); +} + +.dark .article-card:hover { + box-shadow: 0 18px 36px rgba(0, 0, 0, 0.32); } .card-content { @@ -57,38 +64,44 @@ defineProps({ } .title { - margin: 0 0 8px; - font-size: 1.1rem; + margin: 0 0 10px; + font-size: 1.08rem; font-weight: 600; color: var(--vp-c-text-1); + line-height: 1.4; + letter-spacing: -0.01em; } .description { margin: 0; font-size: 0.9rem; color: var(--vp-c-text-2); - line-height: 1.5; + line-height: 1.65; } .tags { - margin-top: 12px; + margin-top: 14px; display: flex; + flex-wrap: wrap; gap: 8px; } .tag { font-size: 0.75rem; - padding: 2px 8px; - border-radius: 4px; - background-color: var(--vp-c-bg-mute); + padding: 4px 10px; + border-radius: 999px; + background-color: color-mix(in srgb, var(--vp-c-brand-1) 10%, var(--vp-c-bg-mute)); color: var(--vp-c-text-2); } .arrow { margin-left: 16px; - font-size: 1.2rem; + margin-top: 2px; + font-size: 1rem; color: var(--vp-c-text-3); transition: transform 0.2s; + line-height: 1; + font-weight: 700; } .article-card:hover .arrow { diff --git a/docs/.vitepress/theme/components/ArticleGrid.vue b/docs/.vitepress/theme/components/ArticleGrid.vue index 339ac51..467da2f 100644 --- a/docs/.vitepress/theme/components/ArticleGrid.vue +++ b/docs/.vitepress/theme/components/ArticleGrid.vue @@ -22,9 +22,18 @@ defineProps({ diff --git a/docs/.vitepress/theme/components/CategoryIndex.vue b/docs/.vitepress/theme/components/CategoryIndex.vue index 8f267c7..08788bd 100644 --- a/docs/.vitepress/theme/components/CategoryIndex.vue +++ b/docs/.vitepress/theme/components/CategoryIndex.vue @@ -42,29 +42,46 @@ defineProps({ diff --git a/docs/.vitepress/theme/components/HomeFeatures.vue b/docs/.vitepress/theme/components/HomeFeatures.vue index f71c1c6..3832a8b 100644 --- a/docs/.vitepress/theme/components/HomeFeatures.vue +++ b/docs/.vitepress/theme/components/HomeFeatures.vue @@ -7,9 +7,11 @@ const router = useRouter() const { site, page, lang } = useData() const activeTab = ref('home') const showLangMenu = ref(false) +const topPromoProgress = ref(1) // Appendix Scroll Logic const appendixWrapper = ref(null) +const pmSection = ref(null) const totalPages = ref(1) const currentPage = ref(0) @@ -1595,6 +1597,38 @@ const closeLangMenu = (e) => { } } +const updateTopPromoVisibility = () => { + if (!pmSection.value) { + topPromoProgress.value = 1 + return + } + const navHeight = 44 + const sectionTop = pmSection.value.getBoundingClientRect().top + window.pageYOffset + const endY = sectionTop - navHeight + const startY = endY - 96 + const scrollY = window.pageYOffset + if (scrollY <= startY) { + topPromoProgress.value = 1 + return + } + if (scrollY >= endY) { + topPromoProgress.value = 0 + return + } + topPromoProgress.value = (endY - scrollY) / (endY - startY) +} + +const topPromoStyle = computed(() => { + const progress = topPromoProgress.value + return { + opacity: progress, + transform: `translateY(${-100 * (1 - progress)}%)`, + maxHeight: `${30 * progress}px`, + borderTopColor: `rgba(229, 229, 234, ${progress})`, + pointerEvents: progress < 0.02 ? 'none' : 'auto' + } +}) + onMounted(() => { document.addEventListener('click', closeLangMenu) if (appendixWrapper.value) { @@ -1602,6 +1636,9 @@ onMounted(() => { updatePagination() window.addEventListener('resize', updatePagination) } + updateTopPromoVisibility() + window.addEventListener('scroll', updateTopPromoVisibility, { passive: true }) + window.addEventListener('resize', updateTopPromoVisibility) }) onUnmounted(() => { @@ -1610,6 +1647,8 @@ onUnmounted(() => { appendixWrapper.value.removeEventListener('scroll', onAppendixScroll) } window.removeEventListener('resize', updatePagination) + window.removeEventListener('scroll', updateTopPromoVisibility) + window.removeEventListener('resize', updateTopPromoVisibility) }) // Stage 1: 产品经理 (Web 原型) @@ -1860,7 +1899,10 @@ const appendixCards = [ -