feat: 更新 ESLint 和 Prettier 配置,增强代码质量管理
- 在 .gitignore 中添加 public/audio/* 以忽略音频文件。 - 更新 bun.lock,添加 eslint-config-prettier 和 eslint-plugin-prettier 依赖,确保 ESLint 与 Prettier 的兼容性。 - 修改 eslint.config.ts,整合 Prettier 规则,优化代码风格一致性。 - 在 package.json 中添加 lint:fix 和 format 脚本,简化代码格式化和修复流程。 - 更新 tailwind.config.ts 和其他组件文件,统一代码风格,提升可读性。
This commit is contained in:
1 parent
5d00adc1a5
commit
76c67b492e
216 files changed
+12454
-13976
No files matched your search
@@ -1,34 +1,30 @@
|
||||
import { createContext, useContext, ReactNode } from "react";
|
||||
import { createContext, useContext, ReactNode } from 'react'
|
||||
|
||||
interface PuzzleAnimationContextType {
|
||||
/** 触发碎片动画,传递碎片ID */
|
||||
triggerPuzzleAnimation: (pieceId: number) => void;
|
||||
triggerPuzzleAnimation: (pieceId: number) => void
|
||||
}
|
||||
|
||||
const PuzzleAnimationContext = createContext<PuzzleAnimationContextType | null>(
|
||||
null
|
||||
);
|
||||
const PuzzleAnimationContext = createContext<PuzzleAnimationContextType | null>(null)
|
||||
|
||||
export const PuzzleAnimationProvider = ({
|
||||
children,
|
||||
triggerPuzzleAnimation,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
triggerPuzzleAnimation: (pieceId: number) => void;
|
||||
children: ReactNode
|
||||
triggerPuzzleAnimation: (pieceId: number) => void
|
||||
}) => {
|
||||
return (
|
||||
<PuzzleAnimationContext.Provider value={{ triggerPuzzleAnimation }}>
|
||||
{children}
|
||||
</PuzzleAnimationContext.Provider>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
export const usePuzzleAnimation = () => {
|
||||
const context = useContext(PuzzleAnimationContext);
|
||||
const context = useContext(PuzzleAnimationContext)
|
||||
if (!context) {
|
||||
throw new Error(
|
||||
"usePuzzleAnimation must be used within PuzzleAnimationProvider"
|
||||
);
|
||||
throw new Error('usePuzzleAnimation must be used within PuzzleAnimationProvider')
|
||||
}
|
||||
return context;
|
||||
};
|
||||
return context
|
||||
}
|
||||
Reference in new issue
Block a user