Skip to content

Commit

Permalink
style(tooltip): increase tooltip width to 500px and truncate items to…
Browse files Browse the repository at this point in the history
… 2 lines (elastic#2261)
  • Loading branch information
markov00 committed Dec 7, 2023
1 parent def039b commit bde26e4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
@mixin lineClamp($maxLines) {
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $maxLines; /* number of lines to show */
line-clamp: $maxLines;
-webkit-box-orient: vertical;
overflow: hidden;
}

.echMetricText {
position: relative;
padding: 8px;
Expand Down
9 changes: 9 additions & 0 deletions packages/charts/src/components/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,12 @@
overflow: hidden;
min-width: 1px;
}

@mixin lineClamp($maxLines) {
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $maxLines; /* number of lines to show */
line-clamp: $maxLines;
-webkit-box-orient: vertical;
overflow: hidden;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $transitionTime: 200ms;
}

.echTooltip__tableCell--truncate {
@include euiTextTruncate;
@include lineClamp(2);
}

&__metricRow {
Expand Down
8 changes: 4 additions & 4 deletions packages/charts/src/components/tooltip/placement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getStylesFromPlacement(
case 'top-end':
case 'bottom-end':
return {
width: maxWidth,
maxWidth,
justifyContent: 'flex-end',
};
case 'right':
Expand All @@ -34,21 +34,21 @@ export function getStylesFromPlacement(
case 'top-start':
case 'bottom-start':
return {
width: maxWidth,
maxWidth,
justifyContent: 'flex-start',
};
case 'top':
case 'bottom':
return {
width: maxWidth,
maxWidth,
justifyContent: 'center',
};
case 'auto':
case 'auto-start':
case 'auto-end':
default:
return {
width: maxWidth,
maxWidth,
};
}
}
2 changes: 1 addition & 1 deletion packages/charts/src/utils/themes/dark_theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export const DARK_THEME: Theme = {
minHeight: 64,
},
tooltip: {
maxWidth: 260,
maxWidth: 500,
maxTableHeight: 120,
defaultDotColor: Colors.White.keyword,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/charts/src/utils/themes/light_theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export const LIGHT_THEME: Theme = {
minHeight: 64,
},
tooltip: {
maxWidth: 260,
maxWidth: 500,
maxTableHeight: 120,
defaultDotColor: Colors.Black.keyword,
},
Expand Down

0 comments on commit bde26e4

Please sign in to comment.