mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix when only icon is present (#20208)
This commit is contained in:
@@ -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])} />
|
||||
|
||||
<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])} />
|
||||
|
||||
<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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user