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) { export function ButtonContent(props: Props) {
const { icon, className, iconClassName, children } = props; const { icon, className, iconClassName, children } = props;
const styles = getStyles(); const styles = getStyles();
return icon ? ( if (icon && children) {
<span className={cx(styles.content, className)}> return (
<i className={cx([icon, iconClassName])} /> <span className={cx(styles.content, className)}>
&nbsp; &nbsp; <i className={cx([icon, iconClassName])} />
<span>{children}</span> &nbsp; &nbsp;
</span> <span>{children}</span>
) : ( </span>
<span className={styles.content}>{children}</span> );
); }
if (icon) {
return (
<span className={cx(styles.content, className)}>
<i className={cx([icon, iconClassName])} />
</span>
);
}
return <span className={styles.content}>{children}</span>;
} }