Skip to content

Commit 1267200

Browse files
committed
feat: 优化样式文件,简化注释并调整组件样式
1 parent cd17409 commit 1267200

2 files changed

Lines changed: 87 additions & 51 deletions

File tree

.vitepress/config.mts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,22 @@ export default defineConfig({
4242
},
4343
],
4444
// 预连接优化 - 减少外部资源连接延迟
45-
["link", { rel: "preconnect", href: "https://api.github.com", crossorigin: "" }],
46-
["link", { rel: "preconnect", href: "https://api.iconify.design", crossorigin: "" }],
47-
["link", { rel: "preconnect", href: "https://umami.micyou.top", crossorigin: "" }],
45+
[
46+
"link",
47+
{ rel: "preconnect", href: "https://api.github.com", crossorigin: "" },
48+
],
49+
[
50+
"link",
51+
{
52+
rel: "preconnect",
53+
href: "https://api.iconify.design",
54+
crossorigin: "",
55+
},
56+
],
57+
[
58+
"link",
59+
{ rel: "preconnect", href: "https://umami.micyou.top", crossorigin: "" },
60+
],
4861
[
4962
"link",
5063
{ rel: "dns-prefetch", href: "https://avatars.githubusercontent.com" },

.vitepress/theme/style.css

Lines changed: 71 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,21 @@
1-
/**
2-
* MicYou 主题样式
3-
* 主题色基于应用图标提取
4-
*/
5-
6-
/**
7-
* Brand Colors - 基于图标主题色 #334355
8-
* -------------------------------------------------------------------------- */
1+
/* MicYou 主题样式 - 主题色基于应用图标提取 */
92

3+
/* Brand Colors */
104
:root {
11-
/* 主色调 - 深蓝灰 */
125
--vp-c-brand-1: #4a5d73;
136
--vp-c-brand-2: #3d4f64;
147
--vp-c-brand-3: #334355;
158
--vp-c-brand-soft: rgba(51, 67, 85, 0.14);
169
}
1710

18-
/**
19-
* Dark Mode - 深色模式调整
20-
* -------------------------------------------------------------------------- */
21-
2211
.dark {
2312
--vp-c-brand-1: #6b8aad;
2413
--vp-c-brand-2: #5a7a9d;
2514
--vp-c-brand-3: #4a6a8d;
2615
--vp-c-brand-soft: rgba(107, 138, 173, 0.14);
2716
}
2817

29-
/**
30-
* Accessibility - 无障碍优化
31-
* -------------------------------------------------------------------------- */
32-
33-
/* 跳过导航链接 */
18+
/* Accessibility */
3419
.skip-to-content {
3520
position: absolute;
3621
top: -100%;
@@ -50,27 +35,23 @@
5035
top: 16px;
5136
}
5237

53-
/* 全局焦点样式 - 提升键盘导航可见性 */
5438
:focus-visible {
5539
outline: 2px solid var(--vp-c-brand-1);
5640
outline-offset: 2px;
5741
}
5842

59-
/* 按钮焦点样式 */
6043
button:focus-visible,
6144
.btn:focus-visible {
6245
outline: 2px solid var(--vp-c-brand-1);
6346
outline-offset: 2px;
6447
}
6548

66-
/* 链接焦点样式 */
6749
a:focus-visible {
6850
outline: 2px solid var(--vp-c-brand-1);
6951
outline-offset: 2px;
7052
border-radius: 4px;
7153
}
7254

73-
/* 减少动画 - 尊重用户偏好 */
7455
@media (prefers-reduced-motion: reduce) {
7556
*,
7657
*::before,
@@ -81,10 +62,7 @@ a:focus-visible {
8162
}
8263
}
8364

84-
/**
85-
* Component: Home Hero
86-
* -------------------------------------------------------------------------- */
87-
65+
/* Home Hero */
8866
:root {
8967
--vp-home-hero-name-color: transparent;
9068
--vp-home-hero-name-background: linear-gradient(
@@ -93,16 +71,13 @@ a:focus-visible {
9371
#4a6a8d 50%,
9472
#6b8aad 100%
9573
);
96-
9774
--vp-home-hero-image-background-image: linear-gradient(
9875
135deg,
9976
#334355 0%,
10077
#4a6a8d 50%,
10178
#6b8aad 100%
10279
);
10380
--vp-home-hero-image-filter: blur(68px);
104-
105-
/* Hero 按钮主题色 */
10681
--vp-button-brand-border: transparent;
10782
--vp-button-brand-text: #fff;
10883
--vp-button-brand-bg: var(--vp-c-brand-1);
@@ -126,48 +101,96 @@ a:focus-visible {
126101
}
127102
}
128103

129-
.VPTeamMembers .item {
130-
transition: transform 0.3s; /* 平滑过渡 */
104+
.VPHero .text {
105+
font-size: 36px;
106+
line-height: 1.2;
131107
}
132108

109+
.VPTeamMembers .item,
133110
.VPFeatures .items .item {
134-
transition: transform 0.3s; /* 平滑过渡 */
111+
transition: transform 0.3s;
135112
}
136113

137-
/* Hero text 字体缩小 */
138-
.VPHero .text {
139-
font-size: 36px;
140-
line-height: 1.2;
114+
.VPTeamMembers .item:hover,
115+
.VPFeatures .items .item:hover {
116+
transform: translateY(-5px);
141117
}
142118

143-
/**
144-
* Image Optimization - 图片尺寸优化
145-
* 为图片设置固定尺寸以减少布局偏移 (CLS)
146-
* -------------------------------------------------------------------------- */
147-
148-
/* Hero 图片 - 固定尺寸减少 CLS */
119+
/* Image Optimization */
149120
.VPHero .VPImage.image-src {
150121
width: 192px;
151122
height: 192px;
152123
aspect-ratio: 1 / 1;
153124
}
154125

155-
/* 导航栏 Logo - 固定尺寸 */
156126
.VPNavBar .VPImage.logo {
157127
width: 24px;
158128
height: 24px;
159129
aspect-ratio: 1 / 1;
160130
}
161131

162-
/* 确保图片按比例缩放 */
163132
.VPImage {
164133
object-fit: contain;
165134
}
166135

167-
.VPTeamMembers .item:hover {
168-
transform: translateY(-5px); /* 向上移动 */
136+
/* Navbar */
137+
.VPNavBar.screen-open,
138+
.VPNavScreenMenuLink,
139+
.VPNavScreenMenuGroup,
140+
.VPLocalNav {
141+
border-bottom: none;
169142
}
170143

171-
.VPFeatures .items .item:hover {
172-
transform: translateY(-5px); /* 向上移动 */
144+
.divider {
145+
display: none;
146+
}
147+
148+
/* Blur Effects */
149+
.VPNavBar:not(.has-sidebar):not(.home.top) {
150+
background-color: rgba(255, 255, 255, 0);
151+
backdrop-filter: blur(10px);
152+
}
153+
154+
.dark .VPNavBar:not(.has-sidebar):not(.home.top) {
155+
background-color: rgba(30, 30, 32, 0);
156+
}
157+
158+
.DocSearch-Button {
159+
background-color: rgba(255, 255, 255, 0);
160+
backdrop-filter: blur(10px);
161+
}
162+
163+
.VPFeature {
164+
border: none;
165+
box-shadow: 0 10px 30px 0 rgb(0 0 0 / 15%);
166+
background-color: transparent;
167+
}
168+
169+
.curtain {
170+
background-color: rgba(255, 255, 255, 0);
171+
backdrop-filter: blur(10px);
172+
}
173+
174+
.dark .curtain {
175+
background-color: rgba(30, 30, 32, 0);
176+
}
177+
178+
@media (min-width: 960px) {
179+
.VPNavBar:not(.home.top) .content-body {
180+
background-color: rgba(255, 255, 255, 0);
181+
backdrop-filter: blur(10px);
182+
}
183+
184+
.dark .VPNavBar:not(.home.top) .content-body {
185+
background-color: rgba(30, 30, 32, 0);
186+
}
187+
}
188+
189+
.VPLocalNav {
190+
background-color: rgba(255, 255, 255, 0);
191+
backdrop-filter: blur(10px);
192+
}
193+
194+
.dark .VPLocalNav {
195+
background-color: rgba(30, 30, 32, 0);
173196
}

0 commit comments

Comments
 (0)