Skip to content

Commit 718880e

Browse files
authored
Merge pull request #465 from wwayne/svg_example
doc(example): expand SVG example to include elements
2 parents 07d48ef + 4aedf31 commit 718880e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

example/src/index.js

+23-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class Test extends React.Component {
241241
"<ReactTooltip id='getContent' getContent={() => Math.floor(Math.random() * 100)} />"}</p>
242242
</div>
243243
<div>
244-
<p>{"<a data-for='overTime' data-tip>=( •̀д•́)</a>\naaaa" +
244+
<p>{"<a data-for='overTime' data-tip>=( •̀д•́)</a>\n" +
245245
"<ReactTooltip id='overTime' getContent={[() => {\n" +
246246
" return 'Random length content'.slice(0, Math.floor(Math.random() * 21) + 1)\n" +
247247
"}, 1000]}/>"}</p>
@@ -304,14 +304,28 @@ class Test extends React.Component {
304304
</div>
305305
<div className="section">
306306
<h4 className='title'>Test SVG</h4>
307+
<p>Note: if you dynamically change elements in the SVG, add:</p>
308+
<pre>
309+
{" componentDidUpdate() {\n" +
310+
" ReactTooltip.rebuild()\n" +
311+
" }"
312+
}
313+
</pre>
307314
<p className="sub-title"></p>
308315
<div className="example-jsx">
309-
<div className="side">
316+
<div className="side" style={{"textAlign": "center"}}>
310317
<svg data-tip="=( •̀д•́)" data-for="svgTooltip" width="50" height="50">
311318
<circle cx="25" cy="25" r="22" fill="#fff" stroke="#000" strokeWidth="4"/>
312319
</svg>
313320
<ReactTooltip id='svgTooltip'/>
314321
</div>
322+
<div className="side" style={{"textAlign": "center"}}>
323+
<svg width="75" height="50">
324+
<circle data-tip="=( •̀‿•́)" data-for="svgTooltip2" cx="25" cy="25" r="22" fill="#fff" stroke="#000" strokeWidth="4"/>
325+
<circle data-tip="=( ❂‿❂)" data-for="svgTooltip2" cx="50" cy="25" r="16" fill="#ddd" stroke="#444" strokeWidth="4"/>
326+
</svg>
327+
<ReactTooltip id='svgTooltip2'/>
328+
</div>
315329
</div>
316330
<br/>
317331
<pre className='example-pre'>
@@ -320,6 +334,13 @@ class Test extends React.Component {
320334
" <circle cx='25' cy='25' r='22' fill='#fff' stroke='#000' strokeWidth='8'/>\n" +
321335
"</svg>\n" +
322336
"<ReactTooltip id='svgTooltip' />"}</p>
337+
<p>{"<svg width='75' height='50'>\n" +
338+
"<circle data-tip='=( •̀‿•́)' data-for='svgTooltip2'\n" +
339+
" cx='25' cy='25' r='22' fill='#fff' stroke='#000' strokeWidth='4'/>\n" +
340+
"<circle data-tip='=( ❂‿❂)' data-for='svgTooltip2'\n" +
341+
" cx='50' cy='25' r='16' fill='#fdf' stroke='#404' strokeWidth='4'/>\n" +
342+
"</svg>\n" +
343+
"<ReactTooltip id='svgTooltip2'/>"}</p>
323344
</div>
324345
</pre>
325346
</div>

0 commit comments

Comments
 (0)