1
1
/* eslint-disable jsx-a11y/label-has-associated-control */
2
2
import React from 'react' ;
3
+ import { LinkControlProps , ControlStyles , DropDownStyle , Node } from '../../../components/FrontendTypes'
3
4
// Font size of the Controls label and Dropdowns
4
- const controlStyles = {
5
+ const controlStyles : ControlStyles = {
5
6
fontSize : '12px' ,
6
7
padding : '10px' ,
7
8
} ;
8
-
9
- const dropDownStyle = {
9
+
10
+ const dropDownStyle : DropDownStyle = {
10
11
margin : '0.5em' ,
11
12
fontSize : '12px' ,
12
13
fontFamily : 'Roboto, sans-serif' ,
@@ -18,24 +19,10 @@ const dropDownStyle = {
18
19
padding : '2px' ,
19
20
} ;
20
21
21
- type Props = {
22
- layout : string ;
23
- orientation : string ;
24
- linkType : string ;
25
- stepPercent : number ;
26
- selectedNode : string ;
27
- setLayout : ( layout : string ) => void ;
28
- setOrientation : ( orientation : string ) => void ;
29
- setLinkType : ( linkType : string ) => void ;
30
- setStepPercent : ( percent : number ) => void ;
31
- setSelectedNode : ( selectedNode : string ) => void ;
32
- snapShots : Record < string , unknown > ;
33
- } ;
34
-
35
22
// use BFS to put all the nodes under snapShots(which is the tree node) into an array
36
- const nodeList = [ ] ;
23
+ const nodeList : Node [ ] = [ ] ;
37
24
38
- const collectNodes = ( node ) : void => {
25
+ const collectNodes = ( node : Node ) : void => {
39
26
nodeList . splice ( 0 , nodeList . length ) ;
40
27
/* We used the .splice method here to ensure that nodeList
41
28
did not accumulate with page refreshes */
@@ -58,7 +45,7 @@ export default function LinkControls({
58
45
setStepPercent,
59
46
setSelectedNode,
60
47
snapShots,
61
- } : Props ) : JSX . Element {
48
+ } : LinkControlProps ) : JSX . Element {
62
49
collectNodes ( snapShots ) ;
63
50
64
51
return (
0 commit comments