-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #351 from maykinmedia/feature/347-add-better-toolt…
…ip-behind-the-(i)-icons Add improved tooltip to info icons
- Loading branch information
Showing
11 changed files
with
118 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ import "./catalog"; | |
import "./diff"; | ||
import "./general"; | ||
import "./product"; | ||
import "./tooltip"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {dom} from '@fortawesome/fontawesome-svg-core' | ||
import tippy from "tippy.js"; | ||
|
||
|
||
class InfoTooltip { | ||
|
||
constructor(node) { | ||
this.node = node; | ||
const text = this.node.firstChild.textContent; | ||
this.node.firstChild.remove(); | ||
tippy(this.node, { | ||
content: text, | ||
placement: "right", | ||
animation: "scale", | ||
theme: "sdg", | ||
}); | ||
} | ||
} | ||
|
||
const iconsDoneRendering = () => { | ||
const infoIcons = document.querySelectorAll("svg.fa-info-circle[title]"); | ||
[...infoIcons].forEach(icon => new InfoTooltip(icon)); | ||
}; | ||
|
||
dom.i2svg({callback: iconsDoneRendering}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ | |
@import 'diff'; | ||
@import 'reference'; | ||
@import 'flags'; | ||
@import 'tooltip'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@import 'tippy.js/dist/tippy.css'; | ||
@import 'tippy.js/animations/scale.css'; | ||
@import 'colors'; | ||
|
||
|
||
.tippy-box { | ||
background-color: $color_primary_darker; | ||
} | ||
|
||
.tippy-arrow { | ||
color: $color_primary_darker; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters