二货机器人
2 years ago
13 changed files with 133 additions and 65 deletions
@ -1,16 +1,19 @@ |
|||
import type { ComponentToken } from './style'; |
|||
import useEvent from 'rc-util/lib/hooks/useEvent'; |
|||
import type { ConfigProviderProps } from '../../config-provider'; |
|||
import showWaveEffect from './WaveEffect'; |
|||
import type { useToken } from '../../theme/internal'; |
|||
|
|||
export default function useWave( |
|||
nodeRef: React.RefObject<HTMLElement>, |
|||
className: string, |
|||
waveToken?: ComponentToken, |
|||
token: ReturnType<typeof useToken>, |
|||
wave: ConfigProviderProps['wave'], |
|||
): VoidFunction { |
|||
function showWave() { |
|||
const node = nodeRef.current!; |
|||
|
|||
showWaveEffect(node, className, waveToken); |
|||
showWaveEffect(node, className, token, wave); |
|||
} |
|||
|
|||
return showWave; |
|||
return useEvent(showWave); |
|||
} |
|||
|
@ -1,8 +1,9 @@ |
|||
import type { OverrideToken } from '../../interface'; |
|||
import Wave from './wave'; |
|||
import wave from './wave'; |
|||
|
|||
const token: OverrideToken = { |
|||
Wave, |
|||
}; |
|||
const token: OverrideToken = {}; |
|||
|
|||
export default token; |
|||
export default { |
|||
token, |
|||
wave, |
|||
}; |
|||
|
@ -0,0 +1,32 @@ |
|||
import { useStyleRegister } from '@ant-design/cssinjs'; |
|||
import type { UseTokenType } from '../wave'; |
|||
|
|||
export default function useStyle(tokenConfig: UseTokenType) { |
|||
const [theme, token, hashId] = tokenConfig; |
|||
|
|||
useStyleRegister({ theme, token, hashId, path: ['Customize', 'Wave', 'Effect'] }, () => { |
|||
const prefixCls = '.happy-wave'; |
|||
|
|||
return [ |
|||
{ |
|||
[prefixCls]: { |
|||
position: 'fixed', |
|||
left: 0, |
|||
top: 0, |
|||
width: 20, |
|||
height: 20, |
|||
background: 'green', |
|||
|
|||
[`${prefixCls}-dot`]: { |
|||
position: 'absolute', |
|||
left: 0, |
|||
top: 0, |
|||
width: 10, |
|||
height: 10, |
|||
background: 'red', |
|||
}, |
|||
}, |
|||
}, |
|||
]; |
|||
}); |
|||
} |
Loading…
Reference in new issue