import React from 'react'; import PropTypes from 'proptypes'; import _ from 'lodash'; import injectSheet from 'react-jss'; import MaterialUISelectField from 'material-ui/SelectField' import MaterialUICheckbox from 'material-ui/Checkbox'; import { blue500, grey500 } from 'material-ui/styles/colors'; import TextFieldIcon from 'material-ui-textfield-icon'; import Clear from 'material-ui-icons/Clear'; const contextTypes = { settings: PropTypes.object.isRequired, onChange: PropTypes.func.isRequired, disabled: PropTypes.bool.isRequired, addPrinter: PropTypes.object.isRequired, advancedFields: PropTypes.array.isRequired, activePrinter: PropTypes.string }; const propTypes = { name: PropTypes.string.isRequired }; export const SelectField = (props, context) => ( context.onChange(props.name, value)} /> ); SelectField.contextTypes = contextTypes; SelectField.propTypes = propTypes; export const TextField = (props, context) => ( context.onChange(props.name, null)} />} floatingLabelStyle={{ color: context.advancedFields.includes(props.name) ? blue500 : grey500 }} disabled={context.disabled} value={_.get(context, props.name)} onChange={(event, value) => context.onChange(props.name, props.type === 'number' ? parseFloat(value) : value)} /> ); TextField.contextTypes = contextTypes; TextField.propTypes = propTypes; export const Checkbox = (props, context) => ( context.onChange(props.name, value)} /> {context.advancedFields.includes(props.name) && context.onChange(props.name, null)} />} ); Checkbox.contextTypes = contextTypes; Checkbox.propTypes = propTypes;