Skip to content

Commit

Permalink
[maps] fix toolbar action button not filled when selected (#158284)
Browse files Browse the repository at this point in the history
Fixes #158221

Updated CSS selector to look for any class containing
"euiButtonIcon-fill" instead of old "euiButtonIcon--fill". Had to use
wild card select because class name as dynamic id in it, for example
"css-1q7ycil-euiButtonIcon-empty-primary-hoverStyles"

Now, button is filled and icon is white when selected.
<img width="400" alt="Screen Shot 2023-05-23 at 10 34 42 AM"
src="https://github.com/elastic/kibana/assets/373691/821d95da-df7a-4779-a7fa-2ce2aa61fa7d">

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 33f5bb6)
  • Loading branch information
nreese committed May 26, 2023
1 parent 82c4eac commit fa96570
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
position: relative;
transition: transform $euiAnimSpeedNormal ease-in-out, background $euiAnimSpeedNormal ease-in-out;

.euiButtonIcon:not(.euiButtonIcon--fill) {
.mapToolbarOverlay__buttonIcon-empty {
color: $euiTextColor !important;
}

Expand All @@ -26,7 +26,7 @@

// Removes the focus background state because it can induce users to think these buttons are "enabled".
// The buttons functionality are just applied once, so they shouldn't stay highlighted.
.euiButtonIcon:focus:not(:hover) {
.mapToolbarOverlay__buttonIcon-empty:focus:not(:hover) {
background: none;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import React from 'react';
import classNames from 'classnames';
import { EuiButtonIcon, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { TrackApplicationView } from '@kbn/usage-collection-plugin/public';
Expand Down Expand Up @@ -53,6 +54,9 @@ export function FeatureEditTools(props: Props) {
{props.pointsOnly ? null : (
<>
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !drawLineSelected,
})}
key="line"
size="s"
onClick={() => toggleDrawShape(DRAW_SHAPE.LINE)}
Expand All @@ -69,6 +73,9 @@ export function FeatureEditTools(props: Props) {
/>

<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !drawPolygonSelected,
})}
key="polygon"
size="s"
onClick={() => toggleDrawShape(DRAW_SHAPE.POLYGON)}
Expand All @@ -84,6 +91,9 @@ export function FeatureEditTools(props: Props) {
display={drawPolygonSelected ? 'fill' : 'empty'}
/>
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !drawCircleSelected,
})}
key="circle"
size="s"
onClick={() => toggleDrawShape(DRAW_SHAPE.DISTANCE)}
Expand All @@ -99,6 +109,9 @@ export function FeatureEditTools(props: Props) {
display={drawCircleSelected ? 'fill' : 'empty'}
/>
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !drawBBoxSelected,
})}
key="boundingBox"
size="s"
onClick={() => toggleDrawShape(DRAW_SHAPE.BOUNDS)}
Expand All @@ -116,6 +129,9 @@ export function FeatureEditTools(props: Props) {
</>
)}
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !drawPointSelected,
})}
key="point"
size="s"
onClick={() => toggleDrawShape(DRAW_SHAPE.POINT)}
Expand All @@ -131,6 +147,9 @@ export function FeatureEditTools(props: Props) {
display={drawPointSelected ? 'fill' : 'empty'}
/>
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !deleteSelected,
})}
key="delete"
size="s"
onClick={() => toggleDrawShape(DRAW_SHAPE.DELETE)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React from 'react';

import classNames from 'classnames';
import { EuiButtonIcon, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

Expand All @@ -31,6 +31,9 @@ export function FitToData(props: Props) {
return (
<EuiPanel paddingSize="none" className="mapToolbarOverlay__button">
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !props.autoFitToDataBounds,
})}
size="s"
onClick={props.fitToBounds}
data-test-subj="fitToData"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class SetViewControl extends Component<Props, State> {
button={
<EuiPanel paddingSize="none" className="mapToolbarOverlay__button">
<EuiButtonIcon
className="mapToolbarOverlay__buttonIcon-empty"
size="s"
onClick={this._togglePopover}
data-test-subj="toggleSetViewVisibilityButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import React from 'react';
import classNames from 'classnames';
import { i18n } from '@kbn/i18n';
import { EuiButtonIcon, EuiPanel } from '@elastic/eui';

Expand Down Expand Up @@ -35,6 +36,9 @@ export function TimesliderToggleButton(props: Props) {
return (
<EuiPanel paddingSize="none" className="mapToolbarOverlay__button">
<EuiButtonIcon
className={classNames({
'mapToolbarOverlay__buttonIcon-empty': !props.isTimesliderOpen,
})}
size="s"
onClick={onClick}
data-test-subj="timesliderToggleButton"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export class ToolsControl extends Component<Props, State> {
return (
<EuiPanel paddingSize="none" className="mapToolbarOverlay__button">
<EuiButtonIcon
className="mapToolbarOverlay__buttonIcon-empty"
size="s"
color="text"
iconType="wrench"
Expand Down

0 comments on commit fa96570

Please sign in to comment.