From 761dced565252953a6550f407a36603abb90ad1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 6 Oct 2026 18:53:48 +0800 Subject: [PATCH] =?UTF-8?q?PaneButton=20=E8=AF=AD=E6=B0=94=E7=B1=BB?= =?UTF-8?q?=E5=90=8D=E6=94=B9=E7=94=A8=E6=9F=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - export/tabs/common/PaneButton.tsx 用 TONE_CLASS 映射替换 tone 的嵌套三元 --- .../export/tabs/common/PaneButton.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/ai-game-creator-shell/src/view/project-development/export/tabs/common/PaneButton.tsx b/apps/ai-game-creator-shell/src/view/project-development/export/tabs/common/PaneButton.tsx index 62dfaed32..aa350a7b6 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/export/tabs/common/PaneButton.tsx +++ b/apps/ai-game-creator-shell/src/view/project-development/export/tabs/common/PaneButton.tsx @@ -8,6 +8,16 @@ import type { ReactNode } from 'react'; * 重试),尺寸跟发布面板(`GameDistributionPublishPanel`)对齐:10px/14px 内边距、10px 圆角、 * 600 字重。 */ +/** + * 语气 → 类名。用查表而不是嵌套三元:加第四种语气时只加一行,也不用再读一层分支。 + */ +const TONE_CLASS: Record<'primary' | 'ghost' | 'brand', string> = { + brand: 'border-[#ff2442] bg-[#ff2442] text-white hover:bg-[#e01e3a]', + primary: 'border-[#c7653d] bg-[#c7653d] text-white hover:bg-[#b4562f]', + ghost: + 'border-[#e2cbb8] bg-white/80 text-[#6f5848] hover:border-[#c7653d] hover:text-[#c7653d]', +}; + export function PaneButton({ children, variant = 'ghost', @@ -27,12 +37,7 @@ export function PaneButton({ className?: string; onClick: () => void; }) { - const tone = - variant === 'brand' - ? 'border-[#ff2442] bg-[#ff2442] text-white hover:bg-[#e01e3a]' - : variant === 'primary' - ? 'border-[#c7653d] bg-[#c7653d] text-white hover:bg-[#b4562f]' - : 'border-[#e2cbb8] bg-white/80 text-[#6f5848] hover:border-[#c7653d] hover:text-[#c7653d]'; + const tone = TONE_CLASS[variant]; const sizing = size === 'hero' ? 'w-full justify-center gap-2 rounded-xl px-6 py-4 text-lg font-bold tracking-wide shadow-md'