Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[fix] long names in tooltips (#2405)

Igor Dykhtabb55975082f4
diff --git a/src/components/src/map/layer-hover-info.tsx b/src/components/src/map/layer-hover-info.tsx
index d769517f1..77f9b50f7 100644
--- a/src/components/src/map/layer-hover-info.tsx
+++ b/src/components/src/map/layer-hover-info.tsx
@@ -57,6 +57,12 @@ const StyledTable = styled.table`
color: ${props => props.theme.negativeBtnActBgd};
}
}
+ & .row__value,
+ & .row__name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: no-wrap;
+ }
`;
const StyledDivider = styled.div`
diff --git a/src/components/src/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx b/src/components/src/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx
index a9e4bba2e..b1175ce73 100644
--- a/src/components/src/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx
+++ b/src/components/src/side-panel/interaction-panel/tooltip-config/tooltip-chicklet.tsx
@@ -23,7 +23,7 @@ import styled from 'styled-components';
import classnames from 'classnames';
import {DraggableAttributes} from '@dnd-kit/core';
import {CSS, Transform} from '@dnd-kit/utilities';
-import {ChickletButton, ChickletTag} from '../../../common/item-selector/chickleted-input';
+import {ChickletButton} from '../../../common/item-selector/chickleted-input';
import {Hash, Delete, VertDots} from '../../../common/icons';
import DropdownList from '../../../common/item-selector/dropdown-list';
import {FormattedMessage} from '@kepler.gl/localization';
@@ -122,6 +122,14 @@ const StyledDragHandle = styled.div.attrs({
}
`;
+const StyledTag = styled.span`
+ margin-right: 5px;
+ text-overflow: ellipsis;
+ width: 100%;
+ overflow: hidden;
+ max-width: 160px;
+`;
+
function getFormatTooltip(formatLabels: TimeLabelFormat[], format: string | null) {
if (!format) {
return null;
@@ -204,7 +212,7 @@ function TooltipChickletFactory(
<StyledDragHandle {...listeners}>
<VertDots height="12px" />
</StyledDragHandle>
- <ChickletTag>{displayOption(item)}</ChickletTag>
+ <StyledTag title={displayOption(item)}>{displayOption(item)}</StyledTag>
{formatLabels.length > 1 && (
<ChickletAddonWrapper>
<TippyTooltip