import { Children, cloneElement, forwardRef } from 'react'; import type { ButtonProps } from './interface'; import { StyledTextButton } from './styles'; import { getSize } from './utils'; export const TextButton = forwardRef( ( { size = 'default', disabled = false, hoverBackground, hoverColor, hoverStyle, shape = 'default', icon, type = 'default', children, bold = false, ...props }, ref ) => { const { iconSize } = getSize(size); return ( {icon && cloneElement(Children.only(icon), { width: iconSize, height: iconSize, className: `affine-button-icon ${icon.props.className ?? ''}`, })} {children && {children}} ); } ); TextButton.displayName = 'TextButton'; export default TextButton;