diff --git a/packages/components/src/button/Button.tsx b/packages/components/src/button/Button.tsx index 717932b3..d9fc4064 100644 --- a/packages/components/src/button/Button.tsx +++ b/packages/components/src/button/Button.tsx @@ -1,17 +1,24 @@ -import { - getComponentClass, - CLASS_SIZE_LG, - CLASS_SIZE_SM, - CLASS_SIZE_M, -} from '@pkg/shared'; +import { getSizeClassName, getClasses } from '@pkg/shared'; import { ButtonContext } from '~/button/button.context'; -import { useBtnIcon, useBtnWave } from './button.hooks'; import type { RequiredPart } from '@tool-pack/types'; import type { ButtonProps } from './button.types'; import { getClassNames } from '@tool-pack/basic'; +import { useBtnWave, useBtnIcon } from './hooks'; import React, { useContext } from 'react'; -const rootClass = getComponentClass('button'); +const cls = getClasses( + 'button', + ['icon'], + [ + 'plain-dashed', + 'plain-text', + 'plain', + 'icon-l', + 'icon-r', + 'icon-only', + 'loading', + ], +); const defaultProps = { shape: 'default', type: 'default', @@ -43,8 +50,8 @@ export const Button = React.forwardRef( keyof typeof defaultProps >; - const [btnWave, activateWave] = useBtnWave(rootClass); - const btnIcon = useBtnIcon(rootClass, icon, loading); + const [btnWave, activateWave] = useBtnWave(cls.root); + const btnIcon = useBtnIcon(cls.root, icon, loading); const clickHandler: React.MouseEventHandler = ( e, @@ -61,24 +68,22 @@ export const Button = React.forwardRef(