Files
superset2/superset/assets/javascripts/explorev2/components/TextField.jsx
Maxime Beauchemin 7aab8b0ae3 Simplifying the Fields (Controls) interface (#1868)
* Simplifying the Field interface / logic

* Moving ControlLabelWithTooltip where it belongs

* Progress

* Rename FieldClass->FieldType
2017-01-04 15:46:52 -08:00

39 lines
869 B
JavaScript

import React, { PropTypes } from 'react';
import { FormGroup, FormControl } from 'react-bootstrap';
const propTypes = {
name: PropTypes.string.isRequired,
label: PropTypes.string,
description: PropTypes.string,
onChange: PropTypes.func,
value: PropTypes.string,
};
const defaultProps = {
label: null,
description: null,
onChange: () => {},
value: '',
};
export default class TextField extends React.Component {
onChange(event) {
this.props.onChange(this.props.name, event.target.value);
}
render() {
return (
<FormGroup controlId="formInlineName" bsSize="small">
<FormControl
type="text"
placeholder=""
onChange={this.onChange.bind(this)}
value={this.props.value}
/>
</FormGroup>
);
}
}
TextField.propTypes = propTypes;
TextField.defaultProps = defaultProps;