Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Highlight selected layer in TOC #61510

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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 @@ -41,6 +41,11 @@
pointer-events: none !important;
}

.mapTocEntry-isSelected {
background-color: $euiColorLightShade;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been playing around with colors and I suggest the following change:

Suggested change
background-color: $euiColorLightShade;
background-color: tintOrShade($euiColorLightShade, 60%, 20%);

maps@2x

}


.mapTocEntry-visible,
.mapTocEntry-notVisible {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ export class TOCEntry extends React.Component {
const classes = classNames('mapTocEntry', {
'mapTocEntry-isDragging': this.props.isDragging,
'mapTocEntry-isDraggingOver': this.props.isDraggingOver,
'mapTocEntry-isSelected':
this.props.selectedLayer && this.props.selectedLayer.getId() === this.props.layer.getId(),
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ const mockLayer = {
getId: () => {
return LAYER_ID;
},
hasLegendDetails: async () => {
return true;
},
renderLegendDetails: () => {
return <div>TOC details mock</div>;
},
Expand Down Expand Up @@ -83,5 +80,33 @@ describe('TOCEntry', () => {

expect(component).toMatchSnapshot();
});

test('should shade background if selected layer is the same', async () => {
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
const component = shallowWithIntl(<TOCEntry {...defaultProps} selectedLayer={mockLayer} />);

// Ensure all promises resolve
await new Promise(resolve => process.nextTick(resolve));
// Ensure the state changes are reflected
component.update();

expect(component).toMatchSnapshot();
});

test('should not shade background if selected layer is not the same', async () => {
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
const differentLayer = Object.create(mockLayer);
differentLayer.getId = () => {
return 'foobar';
};
const component = shallowWithIntl(
<TOCEntry {...defaultProps} selectedLayer={differentLayer} />
);

// Ensure all promises resolve
await new Promise(resolve => process.nextTick(resolve));
// Ensure the state changes are reflected
component.update();

expect(component).toMatchSnapshot();
});
});
});