import React from 'react' import classnames from 'classnames' import DocLabel from '../fields/DocLabel' /** Wrap a component with a label */ class InputBlock extends React.Component { static propTypes = { label: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.element, ]).isRequired, doc: React.PropTypes.string, action: React.PropTypes.element, children: React.PropTypes.element.isRequired, style: React.PropTypes.object, } onChange(e) { const value = e.target.value return this.props.onChange(value === "" ? null: value) } render() { return
{this.props.doc &&
} {!this.props.doc && } {this.props.action &&
{this.props.action}
}
{this.props.children}
} } export default InputBlock