forked from zulip/zulip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tippyjs: Add library to be used for showing tooltips.
Our aim is to use this library to remove use of bootstrap-tooltip for showing popovers and tooltips. This will remove our dependency on bootstrap for showing tooltips. Thus, bootstrap can be upgrade more independently.
- Loading branch information
Showing
8 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import tippy, {delegate} from "tippy.js"; | ||
|
||
// We override the defaults set by tippy library here, | ||
// so make sure to check this too after checking tippyjs | ||
// documentation for default properties. | ||
tippy.setDefaultProps({ | ||
// We don't want tooltips | ||
// to take more space than | ||
// mobile widths ever. | ||
maxWidth: 300, | ||
|
||
// Some delay to showing / hiding the tooltip makes | ||
// it look less forced and more natural. | ||
delay: [100, 20], | ||
placement: "auto", | ||
|
||
// disable animations to make the | ||
// tooltips feel snappy | ||
animation: false, | ||
|
||
// Show tooltips on long press on touch based | ||
// devices. | ||
touch: ["hold", 750], | ||
|
||
// html content is not supported by default | ||
// enable it by passing data-tippy-allowHtml="true" | ||
// in the tag or a parameter. | ||
}); | ||
|
||
export function initialize() { | ||
delegate("body", { | ||
// Add elements here which are not displayed on | ||
// initial load but are displayed later through | ||
// some means. | ||
// | ||
// Make all html elements having this class | ||
// show tippy styled tooltip on hover. | ||
target: ".tippy-zulip-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
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