Skip to content

Commit 0fc32e6

Browse files
committed
refactor(demo): clean up, adds some non-string attributes
1 parent 646a64f commit 0fc32e6

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

demo/src/App.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ class App extends Component {
231231
});
232232
}
233233

234-
handleNodeClick = () => {
235-
console.log(this.state);
236-
};
237-
238234
render() {
239235
return (
240236
<div className="App">
@@ -245,7 +241,12 @@ class App extends Component {
245241
<h2 className="title">React D3 Tree</h2>
246242
<h3 className="title">v{version}</h3>
247243
<h3 className="title">
248-
<a href="/react-d3-tree/docs">📖 API Docs (v2)</a>
244+
<a href="/react-d3-tree/docs">
245+
<span role="img" aria-label="open book emoji">
246+
📖
247+
</span>{' '}
248+
API Docs (v2)
249+
</a>
249250
</h3>
250251
<h4 className="prop">Examples</h4>
251252
<div style={{ marginBottom: '5px' }}>
@@ -367,6 +368,15 @@ class App extends Component {
367368
/>
368369
</div>
369370

371+
<div className="prop-container">
372+
<h4 className="prop">Zoomable</h4>
373+
<Switch
374+
name="zoomableBtn"
375+
checked={this.state.zoomable}
376+
onChange={this.toggleZoomable}
377+
/>
378+
</div>
379+
370380
<div className="prop-container">
371381
<h4 className="prop">Collapse neighbor nodes</h4>
372382
<Switch
@@ -576,11 +586,11 @@ class App extends Component {
576586
<div ref={tc => (this.treeContainer = tc)} className="tree-container">
577587
<Tree
578588
data={this.state.data}
579-
renderCustomNodeElement={
580-
this.state.renderCustomNodeElement
581-
? rd3tProps => this.state.renderCustomNodeElement(rd3tProps, this.state)
582-
: undefined
583-
}
589+
// renderCustomNodeElement={
590+
// this.state.renderCustomNodeElement
591+
// ? rd3tProps => this.state.renderCustomNodeElement(rd3tProps, this.state)
592+
// : undefined
593+
// }
584594
rootNodeClassName="demo-node"
585595
branchNodeClassName="demo-node"
586596
orientation={this.state.orientation}
@@ -599,9 +609,8 @@ class App extends Component {
599609
styles={this.state.styles}
600610
shouldCollapseNeighborNodes={this.state.shouldCollapseNeighborNodes}
601611
// onUpdate={(...args) => {console.log(args)}}
602-
onNodeClick={(...args) => {
603-
console.log('onNodeClick');
604-
console.log(args);
612+
onNodeClick={(node, evt) => {
613+
console.log('onNodeClick', node, evt);
605614
}}
606615
onNodeMouseOver={(...args) => {
607616
console.log('onNodeMouseOver', args);

demo/src/examples/org-chart.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
{
55
"name": "Manager",
66
"attributes": {
7-
"Department": "Production"
7+
"Department": "Production",
8+
"isFullTime": true,
9+
"weeklyHours": 80
810
},
911
"children": [
1012
{
@@ -34,7 +36,9 @@
3436
{
3537
"name": "Manager",
3638
"attributes": {
37-
"Department": "Marketing"
39+
"Department": "Marketing",
40+
"isFullTime": true,
41+
"weeklyHours": 80
3842
},
3943
"children": [
4044
{

0 commit comments

Comments
 (0)