File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -422,3 +422,29 @@ export const Centered3_Wide_Tree_D: Story = {
422
422
getEdgeClass : getCssFromEdgeData ,
423
423
} ,
424
424
}
425
+
426
+ const buildRandomTree = ( maxDepth = 4 ) : Readonly < Tree > => {
427
+ const numChildren = maxDepth > 0 ? Math . floor ( Math . random ( ) * 4 ) : 0
428
+ const tree : Tree = {
429
+ // eslint-disable-next-line prefer-spread
430
+ children : Array . apply ( undefined , { length : numChildren } as unknown [ ] ) . map (
431
+ ( ) => ( { node : buildRandomTree ( maxDepth - 1 ) } ) ,
432
+ ) ,
433
+ }
434
+
435
+ return tree
436
+ }
437
+
438
+ export const Centered3_Wide_Tree_Random : Story = {
439
+ args : {
440
+ id : 'centered3-wide-tree-random' ,
441
+ svgProps : {
442
+ width : 400 ,
443
+ height : 400 ,
444
+ } ,
445
+ tree : buildRandomTree ( ) ,
446
+ computeLayout : computeSmartLayout ,
447
+ getNodeClass : getCssFromNodeData ,
448
+ getEdgeClass : getCssFromEdgeData ,
449
+ } ,
450
+ }
You can’t perform that action at this time.
0 commit comments