Skip to content

Commit

Permalink
[Uptime] New width/delay definition for waterfall sidebar item tooltip (
Browse files Browse the repository at this point in the history
#100147) (#101083)

* Add new width definition for waterfall sidebar item. Add delay to tooltip.

* Add default value for style if/when undefined.

* Create shared style for eui breakpoints to use by both waterfall tooltip types.

* Add a comment.

* Use viewport units instead of breakpoints.

* Rename a style.

* Add top margin to prevent tooltip from missing target item. Rename a style.

* Adjust custom `margin-top`.

* Add index to tooltip content.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Justin Kambic <justin.kambic@elastic.co>
  • Loading branch information
kibanamachine and justinkambic committed Jun 1, 2021
1 parent 0a3e83a commit e99f42d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
EuiIcon,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { WaterfallTooltipResponsiveMaxWidth } from './styles';
import { FIXED_AXIS_HEIGHT } from './constants';
import { euiStyled } from '../../../../../../../../../src/plugins/kibana_react/common';

Expand Down Expand Up @@ -113,7 +114,13 @@ export const MiddleTruncatedText = ({
<EuiScreenReaderOnly>
<span data-test-subj="middleTruncatedTextSROnly">{fullText}</span>
</EuiScreenReaderOnly>
<EuiToolTip content={fullText} position="top" data-test-subj="middleTruncatedTextToolTip">
<WaterfallTooltipResponsiveMaxWidth
as={EuiToolTip}
content={`${index}. ${fullText}`}
data-test-subj="middleTruncatedTextToolTip"
delay="long"
position="top"
>
<>
{onClick ? (
<StyledButton
Expand Down Expand Up @@ -153,7 +160,7 @@ export const MiddleTruncatedText = ({
</InnerContainer>
)}
</>
</EuiToolTip>
</WaterfallTooltipResponsiveMaxWidth>
<span>
<EuiLink href={url} external target="_blank">
<EuiScreenReaderOnly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ export const WaterfallChartLegendContainer = euiStyled.div`
box-shadow: 0px -1px 4px 0px ${(props) => props.theme.eui.euiColorLightShade};
`; // NOTE: EuiShadowColor is a little too dark to work with the background-color

export const WaterfallChartTooltip = euiStyled.div`
export const WaterfallTooltipResponsiveMaxWidth = euiStyled.div`
margin-top: 16px;
max-width: 90vw;
`;

export const WaterfallChartTooltip = euiStyled(WaterfallTooltipResponsiveMaxWidth)`
background-color: ${(props) => props.theme.eui.euiColorDarkestShade};
border-radius: ${(props) => props.theme.eui.euiBorderRadius};
color: ${(props) => props.theme.eui.euiColorLightestShade};
Expand Down

0 comments on commit e99f42d

Please sign in to comment.