-
-
Notifications
You must be signed in to change notification settings - Fork 49.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: master merge feature
- Loading branch information
Showing
168 changed files
with
46,097 additions
and
44,300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,40 @@ | ||
import * as React from 'react'; | ||
import useEvent from 'rc-util/lib/hooks/useEvent'; | ||
import showWaveEffect from './WaveEffect'; | ||
import { ConfigContext } from '../../config-provider'; | ||
import useToken from '../../theme/useToken'; | ||
import type { GlobalToken } from '../../theme'; | ||
|
||
export type ShowWaveEffect = ( | ||
element: HTMLElement, | ||
info: { | ||
className: string; | ||
token: GlobalToken; | ||
component?: string; | ||
event: MouseEvent; | ||
}, | ||
) => void; | ||
|
||
export default function useWave( | ||
nodeRef: React.RefObject<HTMLElement>, | ||
className: string, | ||
): VoidFunction { | ||
function showWave() { | ||
component?: string, | ||
) { | ||
const { wave } = React.useContext(ConfigContext); | ||
const [, token] = useToken(); | ||
|
||
const showWave = useEvent((event: MouseEvent) => { | ||
const node = nodeRef.current!; | ||
|
||
showWaveEffect(node, className); | ||
} | ||
if (wave?.disabled || !node) { | ||
return; | ||
} | ||
|
||
const { showEffect } = wave || {}; | ||
|
||
// Customize wave effect | ||
(showEffect || showWaveEffect)(node, { className, token, component, event }); | ||
}); | ||
|
||
return showWave; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.