From c86357e132da02492b6f04412e810218537b36aa Mon Sep 17 00:00:00 2001 From: pilar6195 Date: Wed, 26 Jun 2024 14:20:18 -0500 Subject: [PATCH] feat: tooltips can have new lines --- src/styles/global.scss | 5 +++++ src/utils/Helpers.ts | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/styles/global.scss b/src/styles/global.scss index b705e5f..5e918fe 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -34,6 +34,11 @@ pointer-events: none; transition-duration: 350ms; + span { + line-height: 1.2; + white-space: pre-line; + } + .alextras--tooltip-arrow { position: absolute; bottom: -9px; diff --git a/src/utils/Helpers.ts b/src/utils/Helpers.ts index 53c50f0..a402bb1 100644 --- a/src/utils/Helpers.ts +++ b/src/utils/Helpers.ts @@ -565,7 +565,11 @@ export const createTooltip = (target: HTMLElement, contents: string) => { styles: { top: `${target.offsetTop - 15}px`, }, - textContent: contents, + children: [ + createElement('span', { + textContent: contents.trim(), + }), + ], }); const tooltipArrow = createElement('div', {