feat: fix show content when loading

This commit is contained in:
MingLiang Wang
2022-12-28 15:02:01 +08:00
parent c4ff077c11
commit 235fe92771
+9 -7
View File
@@ -43,14 +43,16 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
{loading ? (
<Loading type={type}></Loading>
) : (
icon &&
cloneElement(Children.only(icon), {
width: iconSize,
height: iconSize,
className: `affine-button-icon ${icon.props.className ?? ''}`,
})
<>
{icon &&
cloneElement(Children.only(icon), {
width: iconSize,
height: iconSize,
className: `affine-button-icon ${icon.props.className ?? ''}`,
})}
{children && <span>{children}</span>}
</>
)}
{children && <span>{children}</span>}
</StyledButton>
);
}