Skip to content

Commit

Permalink
feat: tooltips can have new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pilar6195 committed Jun 26, 2024
1 parent a5c6d12 commit c86357e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/utils/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit c86357e

Please sign in to comment.