Skip to content

Commit ba27ef7

Browse files
committed
Tweak example
1 parent ad930bf commit ba27ef7

File tree

1 file changed

+8
-3
lines changed
  • src/examples/basicExample

1 file changed

+8
-3
lines changed

src/examples/basicExample/app.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import '../shared/favicon/favicon-32x32.png';
88
import '../shared/favicon/favicon.ico';
99
import '../shared/favicon/safari-pinned-tab.svg';
1010

11+
const maxDepth = 5;
12+
1113
class App extends Component {
1214
constructor(props) {
1315
super(props);
@@ -99,7 +101,7 @@ class App extends Component {
99101
{
100102
expanded: true,
101103
title: 'Limit nesting with `maxDepth`',
102-
subtitle: 'It\'s set to 5 for this example',
104+
subtitle: `It's set to ${maxDepth} for this example`,
103105
children: [
104106
{
105107
expanded: true,
@@ -111,7 +113,10 @@ class App extends Component {
111113
children: [
112114
{ title: renderDepthTitle },
113115
{
114-
title: 'This cannot be dragged deeper',
116+
title: ({ path }) => (path.length >= maxDepth ?
117+
'This cannot be dragged deeper' :
118+
'This can be dragged deeper'
119+
),
115120
},
116121
],
117122
},
@@ -264,7 +269,7 @@ class App extends Component {
264269
<SortableTree
265270
treeData={treeData}
266271
onChange={this.updateTreeData}
267-
maxDepth={5}
272+
maxDepth={maxDepth}
268273
searchQuery={searchString}
269274
searchFocusOffset={searchFocusIndex}
270275
searchFinishCallback={matches =>

0 commit comments

Comments
 (0)