diff --git a/src/ActionIcon/index.tsx b/src/ActionIcon/index.tsx index d4aa8160..173239de 100644 --- a/src/ActionIcon/index.tsx +++ b/src/ActionIcon/index.tsx @@ -6,9 +6,8 @@ import Spotlight from '@/components/Spotlight'; import { DivProps } from '@/types'; import { type TooltipProps } from 'antd'; -import { useStyles } from './style'; - import { ActionIcon as ProEditorActionIcon } from '@ant-design/pro-editor'; +import { useStyles } from './style'; export type ActionIconSize = | 'large' @@ -116,63 +115,68 @@ export interface ActionIconProps extends DivProps { tooltipDelay?: number; } -const ActionIcon = forwardRef( - ( - { - color, - fill, - className, - active, - icon, - size = 'normal', - style, - glass, - spotlight, - onClick, - children, - loading, - ...props - }, - ref, - ) => { - const { styles, cx } = useStyles({ active: Boolean(active), glass: Boolean(glass) }); - - const { blockSize, borderRadius } = useMemo(() => calcSize(size), [size]); - - const content = ( - <> - {icon && ( - - )} - {children} - - ); - - const spin = ( - - ); - - const actionIconBlock = ( -
- {spotlight && } - {loading ? spin : content} -
- ); - - return ; - }, -); +const ActionIcon = forwardRef((props, ref) => { + const { + color, + fill, + className, + active, + icon, + size = 'normal', + style, + glass, + spotlight, + onClick, + children, + loading, + title, + placement, + arrow = false, + tooltipDelay = 0.5, + ...rest + } = props; + + const { styles, cx } = useStyles({ active: Boolean(active), glass: Boolean(glass) }); + + const { blockSize, borderRadius } = useMemo(() => calcSize(size), [size]); + + const content = ( + <> + {icon && ( + + )} + {children} + + ); + + const spin = ; + + const actionIconBlock = ( +
+ {spotlight && } + {loading ? spin : content} +
+ ); + + return ( + <> + + + ); +}); export default ActionIcon; diff --git a/src/ActionIcon/style.ts b/src/ActionIcon/style.ts index 557e8023..7dd47e29 100644 --- a/src/ActionIcon/style.ts +++ b/src/ActionIcon/style.ts @@ -1,7 +1,7 @@ import { createStyles } from 'antd-style'; export const useStyles = createStyles( - ({ css, token, stylish, cx }, { active, glass }: { active: boolean; glass: boolean }) => { + ({ css, stylish, cx }, { glass }: { active: boolean; glass: boolean }) => { return { block: cx( glass && stylish.blur, @@ -14,34 +14,8 @@ export const useStyles = createStyles( flex: none; align-items: center; justify-content: center; - - color: ${active ? token.colorText : token.colorTextTertiary}; - - background: ${active ? token.colorFillTertiary : 'transparent'}; - - transition: - color 600ms ${token.motionEaseOut}, - scale 400ms ${token.motionEaseOut}, - background-color 100ms ${token.motionEaseOut}; - - &:hover { - color: ${token.colorText}; - background-color: ${token.colorFillSecondary}; - } - - &:active { - color: ${token.colorText}; - background-color: ${token.colorFill}; - } `, ), - icon: css` - transition: scale 400ms ${token.motionEaseOut}; - - &:active { - scale: 0.8; - } - `, }; }, );