Fix when only icon is present (#20208)

This commit is contained in:
Andrej Ocenas
2019-11-06 17:28:41 +01:00
committed by GitHub
parent 89c553cfe6
commit 0f709cffbc

View File

@@ -18,13 +18,22 @@ type Props = {
export function ButtonContent(props: Props) {
const { icon, className, iconClassName, children } = props;
const styles = getStyles();
return icon ? (
<span className={cx(styles.content, className)}>
<i className={cx([icon, iconClassName])} />
&nbsp; &nbsp;
<span>{children}</span>
</span>
) : (
<span className={styles.content}>{children}</span>
);
if (icon && children) {
return (
<span className={cx(styles.content, className)}>
<i className={cx([icon, iconClassName])} />
&nbsp; &nbsp;
<span>{children}</span>
</span>
);
}
if (icon) {
return (
<span className={cx(styles.content, className)}>
<i className={cx([icon, iconClassName])} />
</span>
);
}
return <span className={styles.content}>{children}</span>;
}