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