mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana/ui: Fix margin in RadioButtonGroup option when only icon is present (#68899)
This commit is contained in:
parent
5d11def033
commit
417f6ceeb6
@ -75,6 +75,7 @@ export function RadioButtonGroup<T>({
|
|||||||
{options.map((opt, i) => {
|
{options.map((opt, i) => {
|
||||||
const isItemDisabled = disabledOptions && opt.value && disabledOptions.includes(opt.value);
|
const isItemDisabled = disabledOptions && opt.value && disabledOptions.includes(opt.value);
|
||||||
const icon = opt.icon ? toIconName(opt.icon) : undefined;
|
const icon = opt.icon ? toIconName(opt.icon) : undefined;
|
||||||
|
const hasNonIconPart = Boolean(opt.imgUrl || opt.label || opt.component);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RadioButton
|
<RadioButton
|
||||||
@ -91,7 +92,7 @@ export function RadioButtonGroup<T>({
|
|||||||
fullWidth={fullWidth}
|
fullWidth={fullWidth}
|
||||||
ref={value === opt.value ? activeButtonRef : undefined}
|
ref={value === opt.value ? activeButtonRef : undefined}
|
||||||
>
|
>
|
||||||
{icon && <Icon name={icon} className={styles.icon} />}
|
{icon && <Icon name={icon} className={cx(hasNonIconPart && styles.icon)} />}
|
||||||
{opt.imgUrl && <img src={opt.imgUrl} alt={opt.label} className={styles.img} />}
|
{opt.imgUrl && <img src={opt.imgUrl} alt={opt.label} className={styles.img} />}
|
||||||
{opt.label} {opt.component ? <opt.component /> : null}
|
{opt.label} {opt.component ? <opt.component /> : null}
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
|
Loading…
Reference in New Issue
Block a user