Skip to content

Commit 9ab6fe8

Browse files
committed
Update examples
1 parent 91658a3 commit 9ab6fe8

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

examples/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="x-ua-compatible" content="ie=edge">
6-
<title>infinite-tree</title>
6+
<title>react-infinite-tree</title>
77
<meta name="description" content="">
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<link rel="stylesheet" href="vendor/bootstrap/3.3.6/css/bootstrap.min.css">

examples/renderer.js

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import ReactDOMServer from 'react-dom/server';
32
import classNames from 'classnames';
43

54
const renderer = (node, treeOptions) => {
@@ -9,7 +8,7 @@ const renderer = (node, treeOptions) => {
98
const childrenLength = Object.keys(children).length;
109
const more = node.hasChildren();
1110

12-
return ReactDOMServer.renderToString(
11+
return (
1312
<div
1413
className={classNames(
1514
'infinite-tree-item',
@@ -28,31 +27,21 @@ const renderer = (node, treeOptions) => {
2827
className="infinite-tree-node"
2928
style={{ marginLeft: depth * 18 }}
3029
>
31-
<a
32-
className={(() => {
33-
if (!more && loadOnDemand) {
34-
return classNames(treeOptions.togglerClass, 'infinite-tree-closed');
35-
}
36-
if (more && open) {
37-
return classNames(treeOptions.togglerClass);
38-
}
39-
if (more && !open) {
40-
return classNames(treeOptions.togglerClass, 'infinite-tree-closed');
41-
}
42-
return '';
43-
})()}
44-
>
45-
{!more && loadOnDemand &&
30+
{!more && loadOnDemand &&
31+
<a className={classNames(treeOptions.togglerClass, 'infinite-tree-closed')}>
4632
<i className="glyphicon glyphicon-triangle-right" />
47-
}
48-
{more && open &&
33+
</a>
34+
}
35+
{more && open &&
36+
<a className={classNames(treeOptions.togglerClass)}>
4937
<i className="glyphicon glyphicon-triangle-bottom" />
50-
}
51-
{more && !open &&
38+
</a>
39+
}
40+
{more && !open &&
41+
<a className={classNames(treeOptions.togglerClass, 'infinite-tree-closed')}>
5242
<i className="glyphicon glyphicon-triangle-right" />
53-
}
54-
</a>
55-
43+
</a>
44+
}
5645
<i
5746
className={classNames(
5847
'infinite-tree-folder-icon',
@@ -61,11 +50,8 @@ const renderer = (node, treeOptions) => {
6150
{ 'glyphicon-folder-close': more && !open },
6251
{ 'glyphicon-file': !more }
6352
)}
64-
>
65-
</i>
66-
53+
/>
6754
<span className="infinite-tree-title">{name}</span>
68-
6955
<i
7056
style={{ marginLeft: 5 }}
7157
className={classNames(
@@ -75,7 +61,6 @@ const renderer = (node, treeOptions) => {
7561
{ 'rotating': loading }
7662
)}
7763
/>
78-
7964
<span className="count">{childrenLength}</span>
8065
</div>
8166
</div>

0 commit comments

Comments
 (0)