Skip to content

Commit eb4852a

Browse files
committed
fix: improve homepage hierarchy and repository link
1 parent bc3ddae commit eb4852a

4 files changed

Lines changed: 92 additions & 31 deletions

File tree

‎docs/assets/stylesheets/extra.css‎

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ body {
178178
}
179179

180180
.ae-hero {
181-
display: grid;
182-
gap: 1.5rem;
183-
grid-template-columns: minmax(0, 1.35fr) minmax(15rem, 0.65fr);
184181
margin: 0.5rem 0 2.6rem;
182+
max-width: 48rem;
185183
position: relative;
186184
}
187185

@@ -206,31 +204,43 @@ body {
206204
text-transform: uppercase;
207205
}
208206

207+
.ae-hero h1 {
208+
margin-top: 0;
209+
max-width: 44rem;
210+
}
211+
209212
.ae-lead {
210213
font-size: clamp(1rem, 2vw, 1.25rem);
211214
line-height: 1.75;
212215
margin: 0;
213-
max-width: 44rem;
216+
max-width: 38rem;
214217
}
215218

216-
.ae-hero__panel {
217-
align-self: end;
218-
background: var(--ae-paper-raised);
219-
border: 1px solid var(--ae-ink);
220-
box-shadow: var(--ae-shadow);
221-
padding: 1.1rem;
219+
.ae-hero__actions {
220+
align-items: center;
221+
display: flex;
222+
flex-wrap: wrap;
223+
gap: 1rem;
224+
margin-top: 1.35rem;
222225
}
223226

224227
.ae-metrics {
228+
border-bottom: 1px solid var(--ae-line);
229+
border-top: 1px solid var(--ae-line);
225230
display: grid;
226-
gap: 0.7rem;
227-
grid-template-columns: repeat(3, 1fr);
231+
gap: 1rem;
232+
grid-template-columns: repeat(3, minmax(0, 1fr));
233+
margin-top: 2rem;
234+
padding: 0.9rem 0;
228235
}
229236

230237
.ae-metric {
231-
border-left: 2px solid var(--ae-trace);
232238
min-width: 0;
233-
padding-left: 0.65rem;
239+
}
240+
241+
.ae-metric + .ae-metric {
242+
border-left: 1px solid var(--ae-line);
243+
padding-left: 1rem;
234244
}
235245

236246
.ae-metric strong {
@@ -256,7 +266,6 @@ body {
256266
font-family: "Avenir Next Condensed", "DIN Condensed", sans-serif;
257267
font-weight: 750;
258268
gap: 0.5rem;
259-
margin-top: 1.2rem;
260269
padding: 0.65rem 0.95rem;
261270
text-decoration: none !important;
262271
transition: transform 130ms ease, box-shadow 130ms ease;
@@ -268,6 +277,16 @@ body {
268277
transform: translate(2px, 2px);
269278
}
270279

280+
.ae-route {
281+
font-family: "Avenir Next Condensed", "DIN Condensed", sans-serif;
282+
font-weight: 750;
283+
text-decoration-thickness: 0.1em !important;
284+
}
285+
286+
.ae-route::after {
287+
content: " →";
288+
}
289+
271290
.ae-path-grid {
272291
display: grid;
273292
gap: 0.9rem;
@@ -329,10 +348,6 @@ body {
329348
}
330349

331350
@media (max-width: 52rem) {
332-
.ae-hero {
333-
grid-template-columns: 1fr;
334-
}
335-
336351
.ae-path-grid {
337352
grid-template-columns: 1fr;
338353
}
@@ -344,11 +359,25 @@ body {
344359
}
345360

346361
.ae-metrics {
347-
grid-template-columns: 1fr;
362+
gap: 0.45rem;
348363
}
349364

350365
.ae-metric {
351-
padding: 0.25rem 0 0.25rem 0.65rem;
366+
padding-left: 0;
367+
}
368+
369+
.ae-metric + .ae-metric {
370+
border-left: 0;
371+
padding-left: 0;
372+
}
373+
374+
.ae-metric strong {
375+
font-size: 1rem;
376+
}
377+
378+
.ae-metric span {
379+
font-size: 0.56rem;
380+
line-height: 1.35;
352381
}
353382
}
354383

‎docs/index.md‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# 模拟电子技术 30 天双轨自学指南
2-
31
<div class="ae-hero" markdown>
4-
<div>
52
<p class="ae-kicker">Analog Electronics · Field Notes 01–30</p>
63

7-
这份指南面向希望在短时间内系统补齐模拟电子技术的学习者。目标是用 30 天建立可计算、可解释、可追问的模拟电路知识框架:每天先守住冲刺轨,再按余力进入深入轨。
4+
# 模拟电子技术 30 天双轨自学指南
85

6+
<p class="ae-lead">从电路语言与器件模型出发,建立能计算、能解释、能承受追问的模拟电路知识框架。</p>
7+
8+
<div class="ae-hero__actions">
99
<a class="ae-start" href="sprint/week-1/#day-1">开始 Day 1 →</a>
10+
<a class="ae-route" href="学习路线与使用方法/">先看学习路线</a>
1011
</div>
1112

12-
<div class="ae-hero__panel">
13-
<div class="ae-metrics">
14-
<div class="ae-metric"><strong>30</strong><span>天双轨路线</span></div>
15-
<div class="ae-metric"><strong>23.4h</strong><span>冲刺轨总时长</span></div>
16-
<div class="ae-metric"><strong>7</strong><span>章完整教材</span></div>
17-
</div>
13+
<div class="ae-metrics" aria-label="课程规模">
14+
<div class="ae-metric"><strong>30 天</strong><span>连续冲刺路线</span></div>
15+
<div class="ae-metric"><strong>23.4 h</strong><span>已计时学习任务</span></div>
16+
<div class="ae-metric"><strong>7 章</strong><span>完整教材与推导</span></div>
1817
</div>
1918
</div>
2019

‎mkdocs.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
site_name: 模拟电子技术自学指南
22
site_description: 从电路基础到面试表达的 30 天双轨模拟电子技术自学指南
3+
repo_url: https://github.com/SamKuler/analog-electronics-guide
4+
repo_name: analog-electronics-guide · Star
35
docs_dir: docs
46
site_dir: _site
57
use_directory_urls: true
@@ -8,6 +10,8 @@ theme:
810
name: material
911
language: zh
1012
font: false
13+
icon:
14+
repo: fontawesome/brands/github
1115
features:
1216
- navigation.sections
1317
- navigation.top

‎tests/test_rendering_contract.py‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ def test_mermaid_fences_use_material_native_renderer(self):
5656
config,
5757
)
5858

59+
def test_header_links_the_public_github_repository(self):
60+
config = (ROOT / "mkdocs.yml").read_text(encoding="utf-8")
61+
62+
self.assertIn(
63+
"repo_url: https://github.com/SamKuler/analog-electronics-guide",
64+
config,
65+
)
66+
self.assertIn(
67+
"repo_name: analog-electronics-guide · Star",
68+
config,
69+
)
70+
self.assertIn("repo: fontawesome/brands/github", config)
71+
72+
def test_homepage_hero_separates_actions_from_metrics(self):
73+
index = (DOCS / "index.md").read_text(encoding="utf-8")
74+
css = (DOCS / "assets" / "stylesheets" / "extra.css").read_text(
75+
encoding="utf-8"
76+
)
77+
78+
self.assertIn('class="ae-hero__actions"', index)
79+
self.assertIn('class="ae-route"', index)
80+
self.assertIn("先看学习路线", index)
81+
self.assertNotIn('class="ae-hero__panel"', index)
82+
self.assertLess(index.index("ae-hero__actions"), index.index("ae-metrics"))
83+
self.assertIn(".ae-hero__actions", css)
84+
self.assertIn(".ae-route", css)
85+
self.assertIn("border-top: 1px solid var(--ae-line);", css)
86+
self.assertIn("border-bottom: 1px solid var(--ae-line);", css)
87+
5988

6089
if __name__ == "__main__":
6190
unittest.main()

0 commit comments

Comments
 (0)