File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import JSONTree from 'react-json-tree' ;
3
+ import PropTypes from 'prop-types' ;
3
4
4
5
const getItemString = ( type , data , itemType , itemString ) => (
5
6
< span >
6
- { /* //
7
- {type} */ }
7
+ { data . name }
8
8
</ span >
9
9
) ;
10
10
11
11
const Tree = ( props ) => {
12
12
const { snapshot } = props ;
13
- console . log ( 'TREE COMPONENT IS PRINTED' ) ;
14
- console . log ( snapshot ) ;
15
13
return (
16
14
< React . Fragment >
17
15
{ snapshot && (
@@ -20,11 +18,26 @@ const Tree = (props) => {
20
18
theme = { { tree : ( ) => ( { className : 'json-tree' } ) } }
21
19
shouldExpandNode = { ( ) => true }
22
20
getItemString = { getItemString }
23
- // labelRenderer={raw => <strong>{raw}</strong>}
24
- // valueRenderer={raw => <em>{raw}</em>}
21
+ labelRenderer = { ( raw ) => {
22
+ if ( typeof raw [ 0 ] !== 'number' ) return < span > { raw [ 0 ] } </ span > ;
23
+ } }
25
24
/>
26
25
) }
27
26
</ React . Fragment >
28
27
) ;
29
28
} ;
29
+
30
+ Tree . propTypes = {
31
+ snapshot : PropTypes . shape ( {
32
+ state : PropTypes . oneOfType ( [
33
+ PropTypes . string ,
34
+ PropTypes . object ,
35
+ ] ) ,
36
+ children : PropTypes . arrayOf (
37
+ PropTypes . object ,
38
+ ) ,
39
+ name : PropTypes . string ,
40
+ } ) . isRequired ,
41
+ } ;
42
+
30
43
export default Tree ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const TravelContainer = ({
15
15
} ) => (
16
16
< div className = "travel-container" >
17
17
< div className = "play-button" onClick = { play } >
18
- { playing ? 'Pause' : 'Play' }
18
+ { playing ? 'Pause' : 'Play' }
19
19
</ div >
20
20
< MainSlider
21
21
snapshotLength = { snapshotsLength }
@@ -34,13 +34,14 @@ const TravelContainer = ({
34
34
) ;
35
35
36
36
TravelContainer . propTypes = {
37
- pause : PropTypes . func . isRequried ,
37
+ pause : PropTypes . func . isRequired ,
38
38
play : PropTypes . func . isRequired ,
39
39
moveBackward : PropTypes . func . isRequired ,
40
40
moveForward : PropTypes . func . isRequired ,
41
41
snapshotsLength : PropTypes . number . isRequired ,
42
42
handleChangeSnapshot : PropTypes . func . isRequired ,
43
43
handleJumpSnapshot : PropTypes . func . isRequired ,
44
44
snapshotIndex : PropTypes . number . isRequired ,
45
+ playing : PropTypes . bool . isRequired ,
45
46
} ;
46
47
export default TravelContainer ;
You can’t perform that action at this time.
0 commit comments