1 import React from 'react';
2 import {storiesOf} from '@kadira/storybook';
3 import {withKnobs} from '@kadira/storybook-addon-knobs';
4 import Tree from './Tree.jsx';
5 import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js';
7 const stories = storiesOf('Version Tree', module);
8 stories.addDecorator(withKnobs);
16 'description': 'string',
19 'creationTime': '2017-06-08T08:55:37.831Z',
20 'modificationTime': '2017-06-08T08:55:37.831Z'
25 'description': 'string',
28 'creationTime': '2017-06-08T08:55:37.831Z',
29 'modificationTime': '2017-06-08T08:55:37.831Z'
34 'description': 'string',
37 'creationTime': '2017-06-08T08:55:37.831Z',
38 'modificationTime': '2017-06-08T08:55:37.831Z'
43 'description': 'string',
46 'creationTime': '2017-06-08T08:55:37.831Z',
47 'modificationTime': '2017-06-08T08:55:37.831Z'
52 'description': 'string',
55 'creationTime': '2017-06-08T08:55:37.831Z',
56 'modificationTime': '2017-06-08T08:55:37.831Z'
61 'description': 'string',
64 'creationTime': '2017-06-08T08:55:37.831Z',
65 'modificationTime': '2017-06-08T08:55:37.831Z'
70 'description': 'string',
73 'creationTime': '2017-06-08T08:55:37.831Z',
74 'modificationTime': '2017-06-08T08:55:37.831Z'
79 'description': 'string',
82 'creationTime': '2017-06-08T08:55:37.831Z',
83 'modificationTime': '2017-06-08T08:55:37.831Z'
87 const divStyle = { width: '200px', borderStyle: 'solid', borderColor: 'black', border: '1px solid black'};
88 const tree = response.results.map(item => ({id: item.id, name: item.name, parent: item.baseId}));
89 const nodeClickHandler = function (node) {
90 window.alert(node.name);
92 stories.add('Classic Version Tree', () => (
94 <Tree nodes={tree} onNodeClick={nodeClickHandler} selectedNodeId={'1234'}/>
96 )).add('Single Version Tree', () => (
98 <Tree nodes={[tree[0]]} onNodeClick={nodeClickHandler}/>
100 )).add('Single Path Version Tree', () => (
102 <Tree nodes={[tree[0], tree[1]]} onNodeClick={nodeClickHandler}/>
104 )).add('Empty Tree', () => (
108 )).add('Add Tree in Version Page Frame', () => (
109 <div style={divStyle}>
110 Tree wider than frame<br/><br/><br/>
112 name={'versions-tree'}
115 onRenderedBeyondWidth={() => {console.log('rendered beyond width')}}
116 allowScaleWidth={false}
117 onNodeClick={nodeClickHandler}/>