Skip to content

Commit 0540ac9

Browse files
committed
docs: fix code tab layout shift and add emerald/violet two-tone theme
1 parent 3334879 commit 0540ac9

3 files changed

Lines changed: 133 additions & 12 deletions

File tree

docs/.vitepress/components/CodeTabs.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ const activeIndex = ref(0)
3030
<div
3131
v-for="(tab, index) in tabs"
3232
:key="tab.label"
33-
v-show="activeIndex === index"
34-
class="code-tab-panel"
33+
:class="['code-tab-panel', { inactive: activeIndex !== index }]"
3534
>
3635
<pre><code>{{ tab.code }}</code></pre>
3736
</div>
@@ -75,9 +74,18 @@ const activeIndex = ref(0)
7574
}
7675
7776
.code-tabs-body {
77+
display: grid;
7878
background: var(--vp-code-block-bg);
7979
}
8080
81+
.code-tab-panel {
82+
grid-area: 1 / 1;
83+
}
84+
85+
.code-tab-panel.inactive {
86+
visibility: hidden;
87+
}
88+
8189
.code-tab-panel pre {
8290
margin: 0;
8391
padding: 16px 24px;

docs/.vitepress/components/HomePage.vue

Lines changed: 99 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ const activeTab = ref<'client' | 'server'>('client')
7070
<section class="hero">
7171
<div class="hero-content">
7272
<div class="hero-text">
73-
<h1 class="hero-title">TurboHTTP</h1>
73+
<h1 class="hero-title"><span class="turbo">Turbo</span><span class="http">HTTP</span></h1>
7474
<p class="hero-tagline">High-Performance HTTP Client & Server for .NET</p>
7575
<div class="hero-badges">
7676
<span class="badge">Zero Alloc</span>
77-
<span class="badge">HTTP/1–3 + QUIC</span>
77+
<span class="badge violet">HTTP/1–3 + QUIC</span>
7878
<span class="badge">Backpressure</span>
7979
</div>
8080
<div class="hero-actions">
@@ -89,11 +89,14 @@ const activeTab = ref<'client' | 'server'>('client')
8989
@click="activeTab = 'client'"
9090
>Client</button>
9191
<button
92-
:class="['tab', { active: activeTab === 'server' }]"
92+
:class="['tab', 'tab-server', { active: activeTab === 'server' }]"
9393
@click="activeTab = 'server'"
9494
>Server</button>
9595
</div>
96-
<pre class="code-block"><code>{{ activeTab === 'client' ? clientCode : serverCode }}</code></pre>
96+
<div class="code-block-stack">
97+
<pre class="code-block" :class="{ inactive: activeTab !== 'client' }"><code>{{ clientCode }}</code></pre>
98+
<pre class="code-block" :class="{ inactive: activeTab !== 'server' }"><code>{{ serverCode }}</code></pre>
99+
</div>
97100
</div>
98101
</div>
99102
</section>
@@ -176,14 +179,22 @@ const activeTab = ref<'client' | 'server'>('client')
176179
.hero-title {
177180
font-size: 48px;
178181
font-weight: 700;
179-
background: linear-gradient(135deg, #10b981, #8b5cf6);
180-
-webkit-background-clip: text;
181-
-webkit-text-fill-color: transparent;
182-
background-clip: text;
183182
margin: 0 0 8px;
184183
line-height: 1.1;
185184
}
186185
186+
.hero-title .turbo {
187+
color: var(--vp-c-brand-1);
188+
}
189+
190+
.hero-title .http {
191+
color: #8b5cf6;
192+
}
193+
194+
.dark .hero-title .http {
195+
color: #a78bfa;
196+
}
197+
187198
.hero-tagline {
188199
font-size: 20px;
189200
color: var(--vp-c-text-2);
@@ -207,6 +218,16 @@ const activeTab = ref<'client' | 'server'>('client')
207218
color: var(--vp-c-brand-1);
208219
}
209220
221+
.badge.violet {
222+
background: rgba(139, 92, 246, 0.14);
223+
color: #8b5cf6;
224+
}
225+
226+
.dark .badge.violet {
227+
background: rgba(167, 139, 250, 0.14);
228+
color: #a78bfa;
229+
}
230+
210231
.hero-actions {
211232
display: flex;
212233
gap: 12px;
@@ -265,6 +286,29 @@ const activeTab = ref<'client' | 'server'>('client')
265286
border-bottom-color: var(--vp-c-brand-1);
266287
}
267288
289+
.tab-server.active {
290+
color: #8b5cf6;
291+
border-bottom-color: #8b5cf6;
292+
}
293+
294+
.dark .tab-server.active {
295+
color: #a78bfa;
296+
border-bottom-color: #a78bfa;
297+
}
298+
299+
.code-block-stack {
300+
display: grid;
301+
background: var(--vp-code-block-bg);
302+
}
303+
304+
.code-block-stack .code-block {
305+
grid-area: 1 / 1;
306+
}
307+
308+
.code-block.inactive {
309+
visibility: hidden;
310+
}
311+
268312
.code-block {
269313
margin: 0;
270314
padding: 20px 24px;
@@ -310,6 +354,14 @@ const activeTab = ref<'client' | 'server'>('client')
310354
border-color: var(--vp-c-brand-1);
311355
}
312356
357+
.feature-card:nth-child(even):hover {
358+
border-color: #8b5cf6;
359+
}
360+
361+
.dark .feature-card:nth-child(even):hover {
362+
border-color: #a78bfa;
363+
}
364+
313365
.feature-card h3 {
314366
margin: 0 0 8px;
315367
font-size: 16px;
@@ -356,10 +408,37 @@ const activeTab = ref<'client' | 'server'>('client')
356408
}
357409
358410
.comparison .highlight {
359-
color: var(--vp-c-brand-1);
360411
font-weight: 600;
361412
}
362413
414+
.comparison tr:nth-child(odd) .highlight {
415+
color: var(--vp-c-brand-1);
416+
}
417+
418+
.comparison tr:nth-child(even) .highlight {
419+
color: #8b5cf6;
420+
}
421+
422+
.dark .comparison tr:nth-child(even) .highlight {
423+
color: #a78bfa;
424+
}
425+
426+
.comparison tbody tr {
427+
transition: background 0.2s;
428+
}
429+
430+
.comparison tbody tr:nth-child(odd):hover {
431+
background: var(--vp-c-brand-soft);
432+
}
433+
434+
.comparison tbody tr:nth-child(even):hover {
435+
background: rgba(139, 92, 246, 0.08);
436+
}
437+
438+
.dark .comparison tbody tr:nth-child(even):hover {
439+
background: rgba(167, 139, 250, 0.08);
440+
}
441+
363442
/* Install */
364443
.install {
365444
padding: 48px 0 64px;
@@ -401,11 +480,21 @@ const activeTab = ref<'client' | 'server'>('client')
401480
transition: border-color 0.2s, color 0.2s;
402481
}
403482
404-
.install-link:hover {
483+
.install-link:nth-child(odd):hover {
405484
border-color: var(--vp-c-brand-1);
406485
color: var(--vp-c-brand-1);
407486
}
408487
488+
.install-link:nth-child(even):hover {
489+
border-color: #8b5cf6;
490+
color: #8b5cf6;
491+
}
492+
493+
.dark .install-link:nth-child(even):hover {
494+
border-color: #a78bfa;
495+
color: #a78bfa;
496+
}
497+
409498
/* Responsive */
410499
@media (max-width: 768px) {
411500
.hero-content {

docs/.vitepress/theme/custom.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,30 @@
102102
margin-top: 48px;
103103
}
104104

105+
/* Navbar alternating hover colors */
106+
.VPNavBarMenuLink:nth-child(even):hover,
107+
.VPNavBarMenuLink:nth-child(even).active {
108+
color: #8b5cf6 !important;
109+
}
110+
111+
.dark .VPNavBarMenuLink:nth-child(even):hover,
112+
.dark .VPNavBarMenuLink:nth-child(even).active {
113+
color: #a78bfa !important;
114+
}
115+
116+
/* Sidebar alternating hover colors */
117+
.VPSidebarItem .link:hover .text {
118+
color: var(--vp-c-brand-1) !important;
119+
}
120+
121+
.VPSidebarItem:nth-child(even) .link:hover .text {
122+
color: #8b5cf6 !important;
123+
}
124+
125+
.dark .VPSidebarItem:nth-child(even) .link:hover .text {
126+
color: #a78bfa !important;
127+
}
128+
105129
/* Inline code styling */
106130
.vp-doc :not(pre) > code {
107131
border-radius: 4px;

0 commit comments

Comments
 (0)