Skip to content

Commit

Permalink
Fix Legend Options and Node Map layout on mobile view (#142052)
Browse files Browse the repository at this point in the history
* Fix Legend Options and Node Map layout on mobile view

* Fix Number of Color bar on mobile

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
crespocarlos and kibanamachine authored Sep 29, 2022
1 parent 13824dd commit 60e5e41
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { euiStyled } from '@kbn/kibana-react-plugin/common';
import React, { SyntheticEvent, useState, useCallback, useEffect } from 'react';
import { first, last } from 'lodash';
import { InfraWaffleMapBounds, InventoryColorPalette, PALETTES } from '../../../../../lib/lib';
Expand Down Expand Up @@ -189,9 +190,10 @@ export const LegendControls = ({
button={buttonComponent}
anchorPosition="leftCenter"
data-test-subj="legendControls"
// panelStyle={{ width: '100%', maxWidth: 375 }}
>
<EuiPopoverTitle>Legend Options</EuiPopoverTitle>
<EuiForm style={{ minWidth: 400 }}>
<StyledEuiForm>
<EuiFormRow
display="columnCompressed"
label={i18n.translate('xpack.infra.legendControls.colorPaletteLabel', {
Expand Down Expand Up @@ -352,7 +354,16 @@ export const LegendControls = ({
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiForm>
</StyledEuiForm>
</EuiPopover>
);
};

const StyledEuiForm = euiStyled(EuiForm)`
min-width: 400px;
@media (max-width: 480px) {
min-width: 100%;
max-width: 100%;
width: 100vw;
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const WaffleMapOuterContainer = euiStyled.div<{ bottomMargin: number; staticHeig
overflow-x: hidden;
overflow-y: auto;
margin-bottom: ${(props) => props.bottomMargin}px;
max-width: calc(100vw - 90px);
${(props) => props.staticHeight && 'min-height: 300px;'}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export const PalettePreview = ({ steps, palette, reverse }: Props) => {
};

const Swatch = euiStyled.div`
width: 15px;
max-width: 15px;
height: 12px;
flex: 0 0 auto;
flex: 1 1 auto;
&:first-child {
border-radius: ${(props) => props.theme.eui.euiBorderRadius} 0 0 ${(props) =>
props.theme.eui.euiBorderRadius};
Expand Down

0 comments on commit 60e5e41

Please sign in to comment.