Skip to content

Commit

Permalink
add css class for append, conditional flex group
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Jun 4, 2021
1 parent 5a25c36 commit 6d35fb7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
color: $euiTextSubduedColor;
}

.lnsChartSwitch__append {
display: inline-flex;
}

// Targeting img as this won't target normal EuiIcon's only the custom svgs's
img.lnsChartSwitch__chartIcon { // stylelint-disable-line selector-no-qualifying-type
// The large icons aren't square so max out the width to fill the height
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,46 +296,47 @@ export const ChartSwitch = memo(function ChartSwitch(props: Props) {
prepend: (
<EuiIcon className="lnsChartSwitch__chartIcon" type={v.icon || 'empty'} />
),
append: (
<EuiFlexGroup
gutterSize="xs"
responsive={false}
style={{ display: 'inline-flex' }}
>
{v.selection.dataLoss !== 'nothing' ? (
<EuiFlexItem grow={false}>
<EuiIconTip
aria-label={i18n.translate('xpack.lens.chartSwitch.dataLossLabel', {
defaultMessage: 'Warning',
})}
type="alert"
color="warning"
content={i18n.translate(
'xpack.lens.chartSwitch.dataLossDescription',
{
defaultMessage:
'Selecting this chart type will result in a partial loss of currently applied configuration selections.',
}
)}
iconProps={{
className: 'lnsChartSwitch__chartIcon',
'data-test-subj': `lnsChartSwitchPopoverAlert_${v.id}`,
}}
/>
</EuiFlexItem>
) : null}
{v.showBetaBadge ? (
<EuiFlexItem grow={false}>
<EuiBadge color="hollow">
<FormattedMessage
id="xpack.lens.chartSwitch.betaLabel"
defaultMessage="Beta"
append:
v.selection.dataLoss !== 'nothing' || v.showBetaBadge ? (
<EuiFlexGroup
gutterSize="xs"
responsive={false}
className="lnsChartSwitch__append"
>
{v.selection.dataLoss !== 'nothing' ? (
<EuiFlexItem grow={false}>
<EuiIconTip
aria-label={i18n.translate('xpack.lens.chartSwitch.dataLossLabel', {
defaultMessage: 'Warning',
})}
type="alert"
color="warning"
content={i18n.translate(
'xpack.lens.chartSwitch.dataLossDescription',
{
defaultMessage:
'Selecting this chart type will result in a partial loss of currently applied configuration selections.',
}
)}
iconProps={{
className: 'lnsChartSwitch__chartIcon',
'data-test-subj': `lnsChartSwitchPopoverAlert_${v.id}`,
}}
/>
</EuiBadge>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
),
</EuiFlexItem>
) : null}
{v.showBetaBadge ? (
<EuiFlexItem grow={false}>
<EuiBadge color="hollow">
<FormattedMessage
id="xpack.lens.chartSwitch.betaLabel"
defaultMessage="Beta"
/>
</EuiBadge>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
) : null,
// Apparently checked: null is not valid for TS
...(subVisualizationId === v.id && { checked: 'on' }),
})
Expand Down

0 comments on commit 6d35fb7

Please sign in to comment.