Skip to content

Commit

Permalink
[Lens] fix suggestion panel styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Jul 4, 2022
1 parent f5c6c21 commit 6d6b835
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,8 @@ describe('editor_frame', () => {
ExpressionRenderer: expressionRendererMock,
};
instance = (await mountWithProvider(<EditorFrame {...props} />)).instance;

act(() => {
instance.find('[data-test-subj="lnsSuggestion"]').at(2).simulate('click');
instance.find('[data-test-subj="lnsSuggestion"]').at(1).simulate('click');
});

expect(mockVisualization.getConfiguration).toHaveBeenCalledTimes(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
.lnsSuggestionPanel__button {
position: relative; // Let the expression progress indicator position itself against the button
flex: 0 0 auto;
width: $lnsSuggestionWidth !important; // sass-lint:disable-line no-important
width: $lnsSuggestionWidth !important; // sass-lint:disable-line no-important
height: $lnsSuggestionHeight;
margin-right: $euiSizeS;
margin-left: $euiSizeXS / 2;
Expand All @@ -40,9 +40,14 @@
}
}

.lnsSuggestionPanel__button-isSelected {
background-color: $euiColorLightestShade !important; // sass-lint:disable-line no-important
border-color: $euiColorMediumShade !important; // sass-lint:disable-line no-important
.lnsSuggestionPanel__card {
width: 100%;
height: 100%;
}

.lnsSuggestionPanel__card-isSelected {
background-color: $euiColorLightestShade !important; // sass-lint:disable-line no-important
border-color: $euiColorMediumShade !important; // sass-lint:disable-line no-important

&:not(:focus) {
box-shadow: none !important; // sass-lint:disable-line no-important
Expand Down Expand Up @@ -93,10 +98,10 @@

.lnsSuggestionPanel__applyChangesPrompt {
height: $lnsSuggestionHeight;
background-color: $euiColorLightestShade !important;
background-color: $euiColorLightestShade !important;

display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,21 @@ const SuggestionPreview = ({
}) => {
return (
<EuiToolTip content={preview.title}>
<div data-test-subj={`lnsSuggestion-${camelCase(preview.title)}`}>
<button
className={classNames('lnsSuggestionPanel__button', {
'lnsSuggestionPanel__button-isSelected': selected,
})}
onClick={onSelect}
data-test-subj="lnsSuggestion"
>
<EuiPanel
className={classNames('lnsSuggestionPanel__card', {
'lnsSuggestionPanel__card-isSelected': selected,
})}
data-test-subj={`lnsSuggestion-${camelCase(preview.title)}`}
hasBorder={true}
hasShadow={false}
className={classNames('lnsSuggestionPanel__button', {
'lnsSuggestionPanel__button-isSelected': selected,
})}
paddingSize="none"
data-test-subj="lnsSuggestion"
onClick={onSelect}
aria-current={!!selected}
aria-label={preview.title}
>
Expand All @@ -173,7 +178,7 @@ const SuggestionPreview = ({
<span className="lnsSuggestionPanel__buttonLabel">{preview.title}</span>
)}
</EuiPanel>
</div>
</button>
</EuiToolTip>
);
};
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/accessibility/apps/lens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
field: 'bytes',
});

await testSubjects.click('lnsSuggestion-barChart > lnsSuggestion');
await testSubjects.click('lnsSuggestion-barChart');
await a11y.testAppSnapshot();
});

Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/lens/group1/smokescreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

await PageObjects.lens.save('twolayerchart');
await testSubjects.click('lnsSuggestion-asDonut > lnsSuggestion');
await testSubjects.click('lnsSuggestion-asDonut');

expect(await PageObjects.lens.getLayerCount()).to.eql(1);
expect(await PageObjects.lens.getDimensionTriggerText('lnsPie_sliceByDimensionPanel')).to.eql(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// add filter to force data fetch to set activeData
await filterBar.addFilter('bytes', 'is between', '200', '10000');

await testSubjects.click('lnsSuggestion-worldCountriesByCountOfRecords > lnsSuggestion');
await testSubjects.click('lnsSuggestion-worldCountriesByCountOfRecords');

await PageObjects.maps.openLegend();
await PageObjects.maps.waitForLayersToLoad();
Expand Down

0 comments on commit 6d6b835

Please sign in to comment.