From bbbd38bffd486345ff6c4b7416e8b9b4d962d8ad Mon Sep 17 00:00:00 2001 From: fishxcode Date: Wed, 25 Nov 2026 13:19:08 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat(home):=20=E9=87=8D=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=A6=96=E5=B1=8F=E4=B8=8E=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 按参考版式重做大标题首屏、灰色代码窗与彩色圆点行 - 新增深色数据带与可靠性状态网格 - 代码窗默认 cURL 示例并提升灰底可读性 - 新增 9 语言首页重设计文案 --- src/components/home/code-samples.ts | 17 +- src/components/home/code-window.tsx | 10 +- src/components/home/sections.tsx | 101 ++++++++++-- src/components/localized-home-page.tsx | 8 +- src/lib/home-redesign-copy.ts | 213 +++++++++++++++++++++++++ 5 files changed, 327 insertions(+), 22 deletions(-) create mode 100644 src/lib/home-redesign-copy.ts diff --git a/src/components/home/code-samples.ts b/src/components/home/code-samples.ts index 414dfd6..d7da40b 100644 --- a/src/components/home/code-samples.ts +++ b/src/components/home/code-samples.ts @@ -7,15 +7,20 @@ let cached: Promise | undefined; /** * 首屏代码窗口的 Tab:在服务端(静态导出时即构建期)用 Shiki 高亮,浏览器不加载高亮器。 - * 窗口在两种主题下都是深色,主题固定为 github-dark。 + * cURL 排在首位,默认示例更完整;窗口是灰色,主题用 github-light 保证代码可读。 */ export function getHeroCodeTabs(): Promise { cached ??= Promise.all( - HOME_CODE_SAMPLES.map(async (sample) => ({ - label: sample.label, - code: sample.code, - node: await highlight(sample.code, { lang: sample.lang, theme: 'github-dark' }), - })), + [...HOME_CODE_SAMPLES] + .sort((a, b) => { + const order = ['cURL', 'Claude Code', 'Codex']; + return order.indexOf(a.label) - order.indexOf(b.label); + }) + .map(async (sample) => ({ + label: sample.label, + code: sample.code, + node: await highlight(sample.code, { lang: sample.lang, theme: 'github-light' }), + })), ).catch((error: unknown) => { // 失败不缓存,下一次渲染重新高亮 cached = undefined; diff --git a/src/components/home/code-window.tsx b/src/components/home/code-window.tsx index c148c83..1b2986e 100644 --- a/src/components/home/code-window.tsx +++ b/src/components/home/code-window.tsx @@ -116,9 +116,9 @@ export function CodeWindow({ return (
-
+
{tabs.map((tab, index) => { const selected = index === active; @@ -138,8 +138,8 @@ export function CodeWindow({ onKeyDown={(event) => onTabKeyDown(event, index)} className={`relative shrink-0 px-4 py-3 font-mono text-xs transition-colors focus-visible:ring-2 focus-visible:ring-white/40 focus-visible:outline-none focus-visible:ring-inset ${ selected - ? 'text-zinc-100 after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:bg-brand' - : 'text-zinc-500 hover:text-zinc-300' + ? 'text-white after:absolute after:inset-x-3 after:bottom-0 after:h-0.5 after:bg-white' + : 'text-white/60 hover:text-white' }`} > {tab.label} @@ -152,7 +152,7 @@ export function CodeWindow({ onClick={copy} aria-label={status || copyLabel} title={status || copyLabel} - className="ml-auto inline-flex size-8 shrink-0 items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-white/5 hover:text-zinc-200 focus-visible:ring-2 focus-visible:ring-white/40 focus-visible:outline-none" + className="ml-auto inline-flex size-8 shrink-0 items-center justify-center rounded-md text-white/70 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white/50 focus-visible:outline-none" > {copyState === 'copied' ? (