Skip to content

Commit

Permalink
[Lens] Break long titles into multiple lines
Browse files Browse the repository at this point in the history
  • Loading branch information
wylieconlon committed Oct 5, 2020
1 parent cd38380 commit b14754c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
width: 100%;
padding: $euiSizeS;
min-height: $euiSizeXXL - 2;
word-break: break-word;

&:focus {
background-color: transparent !important; // sass-lint:disable-line no-important
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ export function onDrop(props: DatasourceDimensionDropHandlerProps<IndexPatternPr
return true;
}

function wrapOnDot(str?: string) {
// u200B is a non-width white-space character, which allows
// the browser to efficiently word-wrap right after the dot
// without us having to draw a lot of extra DOM elements, etc
return str ? str.replace(/\./g, '.\u200B') : '';
}

export const IndexPatternDimensionTriggerComponent = function IndexPatternDimensionTrigger(
props: IndexPatternDimensionTriggerProps
) {
Expand All @@ -249,6 +256,7 @@ export const IndexPatternDimensionTriggerComponent = function IndexPatternDimens
if (!selectedColumn) {
return null;
}
const formattedLabel = wrapOnDot(uniqueLabel);

const triggerLinkA11yText = i18n.translate('xpack.lens.configure.editConfig', {
defaultMessage: 'Click to edit configuration or drag to move',
Expand Down Expand Up @@ -299,7 +307,7 @@ export const IndexPatternDimensionTriggerComponent = function IndexPatternDimens
aria-label={triggerLinkA11yText}
title={triggerLinkA11yText}
>
{uniqueLabel}
{formattedLabel}
</EuiLink>
);
};
Expand Down

0 comments on commit b14754c

Please sign in to comment.