@@ -3,8 +3,9 @@ import PropTypes from 'prop-types';
3
3
import Dropdown from '../widgets/Dropdown' ;
4
4
import RadioBlocks from '../widgets/RadioBlocks' ;
5
5
import React , { Component } from 'react' ;
6
+ import { localize } from 'lib' ;
6
7
7
- export default class AxesSelector extends Component {
8
+ class AxesSelector extends Component {
8
9
constructor ( props , context ) {
9
10
super ( props , context ) ;
10
11
@@ -17,6 +18,7 @@ export default class AxesSelector extends Component {
17
18
18
19
render ( ) {
19
20
const { axesTargetHandler, axesOptions, axesTarget} = this . context ;
21
+ const { localize : _ } = this . props ;
20
22
const hasSecondaryAxis =
21
23
axesOptions &&
22
24
axesOptions . some ( option => {
@@ -26,11 +28,10 @@ export default class AxesSelector extends Component {
26
28
) ;
27
29
} ) ;
28
30
29
- return (
30
- < Field { ... this . props } center >
31
- { hasSecondaryAxis ? (
31
+ if ( hasSecondaryAxis ) {
32
+ return (
33
+ < Field { ... this . props } label = { _ ( 'Select axis' ) } >
32
34
< Dropdown
33
- label = { _ ( 'Select Axis' ) }
34
35
options = { axesOptions . map ( option => {
35
36
if ( option . value !== 'allaxes' ) {
36
37
return {
@@ -45,13 +46,17 @@ export default class AxesSelector extends Component {
45
46
onChange = { axesTargetHandler }
46
47
clearable = { false }
47
48
/>
48
- ) : (
49
- < RadioBlocks
50
- options = { axesOptions }
51
- activeOption = { axesTarget }
52
- onOptionChange = { axesTargetHandler }
53
- />
54
- ) }
49
+ </ Field >
50
+ ) ;
51
+ }
52
+
53
+ return (
54
+ < Field { ...this . props } center >
55
+ < RadioBlocks
56
+ options = { axesOptions }
57
+ activeOption = { axesTarget }
58
+ onOptionChange = { axesTargetHandler }
59
+ />
55
60
</ Field >
56
61
) ;
57
62
}
@@ -63,3 +68,9 @@ AxesSelector.contextTypes = {
63
68
axesTarget : PropTypes . string ,
64
69
fullLayout : PropTypes . object ,
65
70
} ;
71
+
72
+ AxesSelector . propTypes = {
73
+ localize : PropTypes . func ,
74
+ } ;
75
+
76
+ export default localize ( AxesSelector ) ;
0 commit comments