fix: 增强 SwitchButtonGroup 和立即转换按钮的视觉层级
- SwitchButtonGroup 选中按钮阴影从 shadow-sm 升级到 shadow-md - 同步更新单元测试中断言 - Timestamp 立即转换按钮添加 shadow-md 增强边界感
This commit is contained in:
@@ -40,8 +40,8 @@ export default function SwitchButtonGroup<T extends string | number = string>({
|
|||||||
sizeClasses[size]
|
sizeClasses[size]
|
||||||
} ${
|
} ${
|
||||||
value === option.value
|
value === option.value
|
||||||
? 'bg-background text-primary shadow-sm'
|
? 'bg-primary text-primary-foreground shadow-md'
|
||||||
: 'text-muted-foreground hover:text-foreground hover:bg-background/50'
|
: 'text-muted-foreground hover:text-foreground hover:bg-muted'
|
||||||
}`}
|
}`}
|
||||||
style={buttonSx}
|
style={buttonSx}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe('SwitchButtonGroup 组件', () => {
|
|||||||
const buttonB = screen.getByRole('button', { name: /选项B/i });
|
const buttonB = screen.getByRole('button', { name: /选项B/i });
|
||||||
|
|
||||||
// 选中的按钮有 bg-background text-primary shadow-sm 类
|
// 选中的按钮有 bg-background text-primary shadow-sm 类
|
||||||
expect(buttonA).toHaveClass('bg-background', 'text-primary', 'shadow-sm');
|
expect(buttonA).toHaveClass('bg-primary', 'text-primary-foreground', 'shadow-md');
|
||||||
// 未选中的按钮有 text-muted-foreground 类
|
// 未选中的按钮有 text-muted-foreground 类
|
||||||
expect(buttonB).toHaveClass('text-muted-foreground');
|
expect(buttonB).toHaveClass('text-muted-foreground');
|
||||||
});
|
});
|
||||||
@@ -123,7 +123,7 @@ describe('SwitchButtonGroup 组件', () => {
|
|||||||
const button4 = screen.getByRole('button', { name: /^4$/i });
|
const button4 = screen.getByRole('button', { name: /^4$/i });
|
||||||
|
|
||||||
expect(button2).toHaveClass('text-muted-foreground');
|
expect(button2).toHaveClass('text-muted-foreground');
|
||||||
expect(button4).toHaveClass('bg-background', 'text-primary', 'shadow-sm');
|
expect(button4).toHaveClass('bg-primary', 'text-primary-foreground', 'shadow-md');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('点击 number 选项时应传回 number 值', () => {
|
it('点击 number 选项时应传回 number 值', () => {
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default function Index() {
|
|||||||
{/* 立即转换 */}
|
{/* 立即转换 */}
|
||||||
<button
|
<button
|
||||||
onClick={convert}
|
onClick={convert}
|
||||||
className="block mx-auto mt-4 mb-1 max-w-[240px] w-full py-2.5 text-sm font-semibold rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 transition-all"
|
className="block mx-auto mt-4 mb-1 max-w-[240px] w-full py-2.5 text-sm font-semibold rounded-lg bg-primary text-primary-foreground shadow-md hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 transition-all"
|
||||||
>
|
>
|
||||||
{t('timestamp:convertButton')}
|
{t('timestamp:convertButton')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user