diff --git a/example/src/App.js b/example/src/App.js index 52d58641c..a633680bb 100644 --- a/example/src/App.js +++ b/example/src/App.js @@ -1,858 +1,859 @@ -import React, { Component } from "react"; - -import ReactTooltip from "react-tooltip"; - -export default class App extends Component { - constructor(props) { - super(props); - this.state = { - place: "top", - type: "dark", - effect: "float", - condition: false - }; - } - - changePlace(place) { - this.setState({ - place: place - }); - } - - changeType(type) { - this.setState({ - type: type - }); - } - - changeEffect(effect) { - this.setState({ - effect: effect - }); - } - - _onClick() { - this.setState({ - condition: true - }); - } - - render() { - const { place, type, effect } = this.state; - return ( -
- --
Use everything as tooltip
- -- --
This is a global react component tooltip
-You can put every thing here
-- --
----- {"( •̀д•́)\n" + - "
-"} - --- {"( •̀д•́)\n" + - "
-"} -
----- {"ㅇㅅㅇ\n" + - "
-"} - --- {"V(^-^)V\n" + - "
-"} -
----- {"(・ω´・ )\n" + - "
-\n" + - ".extraClass {\n" + - " font-size: 20px !important;\n" + - " pointer-events: auto !important;\n" + - " &:hover {\n" + - "visibility: visible !important;\n" + - "opacity: 1 !important;\n" + - " }\n" + - "}"} - --- {"(・ω´・ )\n" + - "
-\n" + - " .customeTheme {\n" + - " color: #ff6e00 !important;\n" + - " background-color: orange !important;\n" + - " &.place-top {\n" + - " &:after {\n" + - " border-top-color: orange !important;\n" + - " border-top-style: solid !important;\n" + - " border-top-width: 6px !important;\n" + - " }\n" + - " }\n" + - "}"} -
----- {"=( •̀д•́)\n" + - "
-Math.floor(Math.random() * 100)} />"} - --- {"=( •̀д•́)\n" + - "
-{\n" + - " return 'Random length content'.slice(0, Math.floor(Math.random() * 21) + 1)\n" + - "}, 1000]}/>"} -
- --
----- {"
...\n" + - "Math.floor(Math.random() * 100)}/>"} - - --- {"
...\n" + - "{return new Date().toISOString()}, 1000]}/>"} - -
Note: if you dynamically change elements in the SVG, add:
-- {" componentDidUpdate() {\n" + - " ReactTooltip.rebuild()\n" + - " }"} -- -
----- {"\n" + - "
-"} - - {"\n" + - "
-"} -
- Notice that the tooltip delays going away so you can get your - mouse in it. You must set delayUpdate and delayHide for the - tooltip to stay long enough to get your mouse over it. -
- -Put mouse here
-- -- -
- When clickable property is set to true, tooltip - can respond to mouse (or touch) events. -
- ------ { - " (❂‿❂) " - } -
-- {"
-\n" + - " \n" + - " "} -
- Try to resize/zoom in window - tooltip in this sample will try to - magnet to window borders, top left border is priority here. Idea - is following: sometimes you have custom border cases, like custom - scrolls, small windows, iframes, react-tooltip itself can not - cover everything, so up to you if you want to customize default - behavior, or may be just limit it like in this example. -
------ {"( •̀д•́) override\n" + - "
-{\n" + - " const d = document.documentElement;\n" + - " left = Math.min(d.clientWidth - node.clientWidth, left);\n" + - " top = Math.min(d.clientHeight - node.clientHeight, top);\n" + - " left = Math.max(0, left);\n" + - " top = Math.max(0, top);\n" + - " return { top, left }\n" + - "} }>\n" + - " \n" + - "( •̀д•́) noOverride\n" + - "header\n" + - ' \n' + - "footer\n" + - "\n" + - " "} -header\n" + - ' \n' + - "footer\n" + - "
+ ++
Use everything as tooltip
+ ++ ++
This is a global react component tooltip
+You can put every thing here
++ ++
+++++ {"( •̀д•́)\n" + + "
+"} + +++ {"( •̀д•́)\n" + + "
+"} +
+++++ {"ㅇㅅㅇ\n" + + "
+"} + +++ {"V(^-^)V\n" + + "
+"} +
+++++ {"(・ω´・ )\n" + + "
+\n" + + ".extraClass {\n" + + " font-size: 20px !important;\n" + + " pointer-events: auto !important;\n" + + " &:hover {\n" + + "visibility: visible !important;\n" + + "opacity: 1 !important;\n" + + " }\n" + + "}"} + +++ {"(・ω´・ )\n" + + "
+\n" + + " .customeTheme {\n" + + " color: #ff6e00 !important;\n" + + " background-color: orange !important;\n" + + " &.place-top {\n" + + " &:after {\n" + + " border-top-color: orange !important;\n" + + " border-top-style: solid !important;\n" + + " border-top-width: 6px !important;\n" + + " }\n" + + " }\n" + + "}"} +
+++++ {"=( •̀д•́)\n" + + "
+Math.floor(Math.random() * 100)} />"} + +++ {"=( •̀д•́)\n" + + "
+{\n" + + " return 'Random length content'.slice(0, Math.floor(Math.random() * 21) + 1)\n" + + "}, 1000]}/>"} +
+ ++
+++++ {"
...\n" + + "Math.floor(Math.random() * 100)}/>"} + + +++ {"
...\n" + + "{return new Date().toISOString()}, 1000]}/>"} + +
Note: if you dynamically change elements in the SVG, add:
++ {" componentDidUpdate() {\n" + + " ReactTooltip.rebuild()\n" + + " }"} ++ +
+++++ {"\n" + + "
+"} + + {"\n" + + "
+"} +
+ Notice that the tooltip delays going away so you can get your + mouse in it. You must set delayUpdate and delayHide for the + tooltip to stay long enough to get your mouse over it. +
+ +Put mouse here
++ ++ +
+ When clickable property is set to true, tooltip + can respond to mouse (or touch) events. +
+ ++++++ { + " (❂‿❂) " + } +
++ {"
+\n" + + " \n" + + " "} +
+ Try to resize/zoom in window - tooltip in this sample will try to + magnet to window borders, top left border is priority here. Idea + is following: sometimes you have custom border cases, like custom + scrolls, small windows, iframes, react-tooltip itself can not + cover everything, so up to you if you want to customize default + behavior, or may be just limit it like in this example. +
++++++ {"( •̀д•́) override\n" + + "
+{\n" + + " const d = document.documentElement;\n" + + " left = Math.min(d.clientWidth - node.clientWidth, left);\n" + + " top = Math.min(d.clientHeight - node.clientHeight, top);\n" + + " left = Math.max(0, left);\n" + + " top = Math.max(0, top);\n" + + " return { top, left }\n" + + "} }>\n" + + " \n" + + "( •̀д•́) noOverride\n" + + "header\n" + + ' \n' + + "footer\n" + + "\n" + + " "} +header\n" + + ' \n' + + "footer\n" + + "