Merge pull request #597 from toeverything/feature/fix-button-loading

feat: fix show content when loading
This commit is contained in:
MingLiang Wang
2022-12-28 16:10:08 +08:00
committed by GitHub
+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>
);
}