fix(buttons): 修复 RippleButton 文字显示问题并解决 ESLint 错误

修复了 RippleButton 组件因 CVA 默认样式与自定义 className 冲突导致的文字不可见问题。
同时修复了项目中的 TypeScript 类型错误和 ESLint 规范问题。

主要修改:
1. 按钮显示修复:为使用红色文字的按钮添加 variant=outline,
   为使用白色背景的按钮添加 variant=secondary
2. TypeScript 类型修复:修复 subtle-dots.tsx 中的类型定义错误,
   删除不必要的 jest-dom.d.ts 文件
3. ESLint 规范修复:修复 React Hooks 使用规范问题,
   将 useRef+forceUpdate 反模式改为 useState,
   使用 eslint-disable 注释处理合理的 setState in effect 场景
4. 测试增强:添加按钮显示验证脚本和全面的页面按钮检查脚本
This commit is contained in:
张翔
2026-04-27 16:27:35 +08:00
parent e83ecddfe5
commit 1832640e8f
20 changed files with 395 additions and 134 deletions
+5 -3
View File
@@ -22,16 +22,18 @@ export function SubtleDots({
delay: number;
}>>([]);
/* eslint-disable react-hooks/set-state-in-effect */
useEffect(() => {
const generatedDots = Array.from({ length: count }, (_, i) => ({
const newDots = Array.from({ length: count }, (_, i) => ({
id: i,
x: 10 + Math.random() * 80,
y: 10 + Math.random() * 80,
size: 2 + Math.random() * 3,
delay: i * 0.3
}));
setDots(generatedDots);
setDots(newDots);
}, [count]);
/* eslint-enable react-hooks/set-state-in-effect */
if (dots.length === 0) {
return <div className={`absolute inset-0 pointer-events-none ${className}`} />;
@@ -68,4 +70,4 @@ export function SubtleDots({
);
}
export default SubtleDots;
export default SubtleDots;