PaneButton 语气类名改用查表
- export/tabs/common/PaneButton.tsx 用 TONE_CLASS 映射替换 tone 的嵌套三元
This commit is contained in:
+11
-6
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user