admin-on-rest-fr05t1k
Version:
A frontend Framework for building admin applications on top of REST services, using ES6, React and Material UI
37 lines (32 loc) • 1.01 kB
JavaScript
import React, { PropTypes } from 'react';
import SelectInput from './SelectInput';
import translate from '../../i18n/translate';
export const NullableBooleanInput = ({ input, meta, label, source, elStyle, resource, translate }) => (
<SelectInput
input={input}
label={label}
source={source}
resource={resource}
choices={[
{ id: null, name: '' },
{ id: false, name: translate('aor.boolean.false') },
{ id: true, name: translate('aor.boolean.true') },
]}
meta={meta}
style={elStyle}
/>
);
NullableBooleanInput.propTypes = {
addField: PropTypes.bool.isRequired,
elStyle: PropTypes.object,
input: PropTypes.object,
label: PropTypes.string,
meta: PropTypes.object,
resource: PropTypes.string,
source: PropTypes.string,
translate: PropTypes.func.isRequired,
};
NullableBooleanInput.defaultProps = {
addField: true,
};
export default translate(NullableBooleanInput);