@@ -2,31 +2,21 @@ import Field from './Field';
2
2
import PropTypes from 'prop-types' ;
3
3
import RadioBlocks from '../widgets/RadioBlocks' ;
4
4
import React , { Component } from 'react' ;
5
- import { connectToContainer } from '../../lib' ;
6
5
7
6
export default class AxesSelector extends Component {
8
7
constructor ( props , context ) {
9
8
super ( props , context ) ;
10
9
11
- if ( ! props . axesTargetHandler && ! context . axesTargetHandler ) {
10
+ if ( ! context . axesTargetHandler ) {
12
11
throw new Error (
13
- 'AxesSelector must be nested within a connectAxesToPlot component ' +
14
- 'or passed axesTargetHandler and axesOptions props'
12
+ 'AxesSelector must be nested within a connectAxesToPlot component'
15
13
) ;
16
14
}
17
15
}
18
16
19
17
render ( ) {
20
- let axesTargetHandler , axesOptions , axesTarget ;
21
- if ( this . props . axesTargetHandler ) {
22
- axesTargetHandler = this . props . axesTargetHandler ;
23
- axesOptions = this . props . axesOptions ;
24
- axesTarget = this . props . axesTarget ;
25
- } else {
26
- axesTargetHandler = this . context . axesTargetHandler ;
27
- axesOptions = this . context . axesOptions ;
28
- axesTarget = this . context . axesTarget ;
29
- }
18
+ const { axesTargetHandler, axesOptions, axesTarget} = this . context ;
19
+
30
20
return (
31
21
< Field { ...this . props } >
32
22
< RadioBlocks
@@ -39,12 +29,6 @@ export default class AxesSelector extends Component {
39
29
}
40
30
}
41
31
42
- AxesSelector . propTypes = {
43
- axesTargetHandler : PropTypes . func ,
44
- axesOptions : PropTypes . array ,
45
- axesTarget : PropTypes . string ,
46
- } ;
47
-
48
32
AxesSelector . contextTypes = {
49
33
axesTargetHandler : PropTypes . func ,
50
34
axesOptions : PropTypes . array ,
0 commit comments