Files
ohif-viewer/platform/ui/src/elements/form/TextInput.js
T

36 lines
695 B
JavaScript
Raw Normal View History

2019-08-13 15:36:46 -04:00
import './TextInput.css';
import React from 'react';
import PropTypes from 'prop-types';
class TextInput extends React.Component {
constructor(props) {
super(props);
this.state = { value: props.value };
}
handleChange = event => {
this.setState({ value: event.target.value });
if (this.props.onChange) this.props.onChange();
};
render() {
return (
<input
className="input-ohif"
type="text"
value={this.state.value}
onChange={this.handleChange}
id={this.props.id}
/>
);
}
}
TextInput.propTypes = {
value: PropTypes.string,
id: PropTypes.string,
onChange: PropTypes.func,
};
export { TextInput };