Skip to content

Commit

Permalink
Update header tooltips, add base tooltip styling
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Mar 15, 2022
1 parent 7e43dfa commit 133c486
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ THE SOFTWARE.
class="am-button"
href="#"
data-href="${rootURL}/administrativeMonitorsApi/nonSecurityPopupContent"
title="${%tooltip(activeNonSecurityAMCount)}">
tooltip="${%tooltip(activeNonSecurityAMCount)}">
<l:svgIcon
href="${resURL}/images/material-icons/svg-sprite-social-symbol.svg#ic_notifications_24px"/>
<div class="am-monitor__indicator-mobile"/>
Expand All @@ -57,7 +57,7 @@ THE SOFTWARE.
class="am-button security-am"
href="#"
data-href="${rootURL}/administrativeMonitorsApi/securityPopupContent"
title="${%tooltipSec(activeSecurityAMCount)}">
tooltip="${%tooltipSec(activeSecurityAMCount)}">
<l:svgIcon
href="${resURL}/images/material-icons/svg-sprite-action-symbol.svg#ic_warning_shield_24px"/>
<div class="am-monitor__indicator-mobile"/>
Expand Down
22 changes: 10 additions & 12 deletions war/src/main/js/tooltips.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import tippy from "tippy.js"

const TOOLTIP_BASE = {
arrow: false,
theme: "tooltip",
animation: "tooltip",
appendTo: document.body
}

registerTooltips()

/**
Expand All @@ -15,19 +22,13 @@ function registerTooltips() {

tippy("[tooltip]", {
content: element => element.getAttribute("tooltip"),
arrow: false,
theme: "tooltip",
animation: "tooltip",
appendTo: document.body,
...TOOLTIP_BASE
})

tippy("[html-tooltip]", {
content: element => element.getAttribute("html-tooltip"),
allowHTML: true,
arrow: false,
theme: "tooltip",
animation: "tooltip",
appendTo: document.body,
...TOOLTIP_BASE
})
}

Expand All @@ -40,12 +41,9 @@ function hoverNotification(text, element) {
const tooltip = tippy(element, {
interactive: true,
trigger: "hover",
arrow: false,
theme: "tooltip",
offset: [0, 0],
animation: "tooltip",
content: text,
appendTo: document.body,
...TOOLTIP_BASE,
onShow(instance) {
setTimeout(() => {
instance.hide()
Expand Down

0 comments on commit 133c486

Please sign in to comment.