1
1
import React from 'react' ;
2
2
3
- const controlStyles = { fontSize : 10 } ;
4
-
5
- type Props = {
6
- orientation : string ;
7
- linkType : string ;
8
- stepPercent : number ;
9
- setOrientation : ( orientation : string ) => void ;
10
- setLinkType : ( linkType : string ) => void ;
11
- setStepPercent : ( percent : number ) => void ;
12
- } ;
13
-
14
- export default function LinkControls ( {
3
+ const AxLinkControls = ( {
15
4
orientation,
16
5
linkType,
17
6
stepPercent,
18
7
setOrientation,
19
8
setLinkType,
20
9
setStepPercent,
21
- } : Props ) {
10
+ } ) => {
22
11
return (
23
- < div style = { controlStyles } >
24
-
25
- < label > orientation:</ label >
26
- < select
27
- onClick = { ( e ) => e . stopPropagation ( ) }
28
- onChange = { ( e ) => setOrientation ( e . target . value ) }
29
- value = { orientation }
30
- >
31
- < option value = 'vertical' > vertical</ option >
32
- < option value = 'horizontal' > horizontal</ option >
33
- </ select >
34
-
35
- < label > link:</ label >
36
- < select
37
- onClick = { ( e ) => e . stopPropagation ( ) }
38
- onChange = { ( e ) => setLinkType ( e . target . value ) }
39
- value = { linkType }
40
- >
41
- < option value = 'diagonal' > diagonal</ option >
42
- < option value = 'step' > step</ option >
43
- < option value = 'curve' > curve</ option >
44
- < option value = 'line' > line</ option >
45
- </ select >
12
+ < div className = 'link-controls' >
13
+ < div className = 'control-group' >
14
+ < label className = 'control-label' > Orientation:</ label >
15
+ < select
16
+ className = 'control-select'
17
+ onClick = { ( e ) => e . stopPropagation ( ) }
18
+ onChange = { ( e ) => setOrientation ( e . target . value ) }
19
+ value = { orientation }
20
+ >
21
+ < option value = 'vertical' > vertical</ option >
22
+ < option value = 'horizontal' > horizontal</ option >
23
+ </ select >
24
+ </ div >
25
+
26
+ < div className = 'control-group' >
27
+ < label className = 'control-label' > Link:</ label >
28
+ < select
29
+ className = 'control-select'
30
+ onClick = { ( e ) => e . stopPropagation ( ) }
31
+ onChange = { ( e ) => setLinkType ( e . target . value ) }
32
+ value = { linkType }
33
+ >
34
+ < option value = 'diagonal' > diagonal</ option >
35
+ < option value = 'step' > step</ option >
36
+ < option value = 'curve' > curve</ option >
37
+ < option value = 'line' > line</ option >
38
+ </ select >
39
+ </ div >
40
+
46
41
{ linkType === 'step' && (
47
- < >
48
-
49
- < label > step:</ label >
42
+ < div className = 'control-group' >
43
+ < label className = 'control-label' > step:</ label >
50
44
< input
51
45
onClick = { ( e ) => e . stopPropagation ( ) }
52
46
type = 'range'
@@ -56,9 +50,12 @@ export default function LinkControls({
56
50
onChange = { ( e ) => setStepPercent ( Number ( e . target . value ) ) }
57
51
value = { stepPercent }
58
52
disabled = { linkType !== 'step' }
53
+ className = 'control-range'
59
54
/>
60
- </ >
55
+ </ div >
61
56
) }
62
57
</ div >
63
58
) ;
64
- }
59
+ } ;
60
+
61
+ export default AxLinkControls ;
0 commit comments