-
-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathRadio.js
35 lines (31 loc) · 976 Bytes
/
Radio.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import RadioBlocks from '../widgets/RadioBlocks';
import Field from './Field';
import {connectToContainer} from 'lib';
export class UnconnectedRadio extends Component {
render() {
return (
<Field {...this.props} noDefaultIndicator={this.props.noDefaultIndicator}>
<RadioBlocks
options={this.props.options}
activeOption={this.props.fullValue}
onOptionChange={this.props.updatePlot}
/>
</Field>
);
}
}
UnconnectedRadio.propTypes = {
center: PropTypes.bool,
fullValue: PropTypes.any,
options: PropTypes.array.isRequired,
updatePlot: PropTypes.func,
...Field.propTypes,
};
// for better appearance <Radio> overrides <Field> {center: false}
// default prop. This can be overridden manually using props for <Radio>.
UnconnectedRadio.defaultProps = {
center: true,
};
export default connectToContainer(UnconnectedRadio);