ant-design/components/_util/wave/useWave.ts
lijianan 4f16966e28 refactor[Wave]: CC => FC (#39705)
* fix

* refactor[Wave]: CC => FC

* fix lint

* fix

* fix

* fix

* add test case

* add test case

* fix test

* fix test

* test case

* add test case

* fix

* fix

* fix

* fix

* raname

* fix

* test case

* test case

* test case

* fix test

* test case

* refactor: Use React way

* test: coverage

* chore: clean up

* rerun fail ci

* fix: React 17 error

* test: fix test case

* test: fix test case

* fix borderRadius

* test: fix test case

* chore: clean up

* chore: clean up

Co-authored-by: 二货机器人 <smith3816@gmail.com>
2022-12-31 22:24:55 +08:00

19 lines
416 B
TypeScript

import showWaveEffect from './WaveEffect';
export default function useWave(
nodeRef: React.RefObject<HTMLElement>,
className: string,
): VoidFunction {
function showWave() {
const node = nodeRef.current!;
// Skip if not exist doc
const container = node.getRootNode?.() || node?.ownerDocument;
if (container) {
showWaveEffect(container, node, className);
}
}
return showWave;
}