Skip to content

Commit

Permalink
Merge pull request #465 from wwayne/svg_example
Browse files Browse the repository at this point in the history
doc(example): expand SVG example to include elements
  • Loading branch information
aronhelser authored Jan 4, 2019
2 parents 07d48ef + 4aedf31 commit 718880e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions example/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Test extends React.Component {
"<ReactTooltip id='getContent' getContent={() => Math.floor(Math.random() * 100)} />"}</p>
</div>
<div>
<p>{"<a data-for='overTime' data-tip>=( •̀д•́)</a>\naaaa" +
<p>{"<a data-for='overTime' data-tip>=( •̀д•́)</a>\n" +
"<ReactTooltip id='overTime' getContent={[() => {\n" +
" return 'Random length content'.slice(0, Math.floor(Math.random() * 21) + 1)\n" +
"}, 1000]}/>"}</p>
Expand Down Expand Up @@ -304,14 +304,28 @@ class Test extends React.Component {
</div>
<div className="section">
<h4 className='title'>Test SVG</h4>
<p>Note: if you dynamically change elements in the SVG, add:</p>
<pre>
{" componentDidUpdate() {\n" +
" ReactTooltip.rebuild()\n" +
" }"
}
</pre>
<p className="sub-title"></p>
<div className="example-jsx">
<div className="side">
<div className="side" style={{"textAlign": "center"}}>
<svg data-tip="=( •̀д•́)" data-for="svgTooltip" width="50" height="50">
<circle cx="25" cy="25" r="22" fill="#fff" stroke="#000" strokeWidth="4"/>
</svg>
<ReactTooltip id='svgTooltip'/>
</div>
<div className="side" style={{"textAlign": "center"}}>
<svg width="75" height="50">
<circle data-tip="=( •̀‿•́)" data-for="svgTooltip2" cx="25" cy="25" r="22" fill="#fff" stroke="#000" strokeWidth="4"/>
<circle data-tip="=( ❂‿❂)" data-for="svgTooltip2" cx="50" cy="25" r="16" fill="#ddd" stroke="#444" strokeWidth="4"/>
</svg>
<ReactTooltip id='svgTooltip2'/>
</div>
</div>
<br/>
<pre className='example-pre'>
Expand All @@ -320,6 +334,13 @@ class Test extends React.Component {
" <circle cx='25' cy='25' r='22' fill='#fff' stroke='#000' strokeWidth='8'/>\n" +
"</svg>\n" +
"<ReactTooltip id='svgTooltip' />"}</p>
<p>{"<svg width='75' height='50'>\n" +
"<circle data-tip='=( •̀‿•́)' data-for='svgTooltip2'\n" +
" cx='25' cy='25' r='22' fill='#fff' stroke='#000' strokeWidth='4'/>\n" +
"<circle data-tip='=( ❂‿❂)' data-for='svgTooltip2'\n" +
" cx='50' cy='25' r='16' fill='#fdf' stroke='#404' strokeWidth='4'/>\n" +
"</svg>\n" +
"<ReactTooltip id='svgTooltip2'/>"}</p>
</div>
</pre>
</div>
Expand Down

0 comments on commit 718880e

Please sign in to comment.