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) {
|
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)}>
|
||||||
|
<i className={cx([icon, iconClassName])} />
|
||||||
<span>{children}</span>
|
|
||||||
</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>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user