static-cms/src/components/Widgets/StringControl.js

18 lines
435 B
JavaScript
Raw Normal View History

import React, { PropTypes } from 'react';
2016-05-30 16:55:32 -07:00
export default class StringControl extends React.Component {
handleChange = (e) => {
2016-05-30 16:55:32 -07:00
this.props.onChange(e.target.value);
2016-10-03 14:25:27 +02:00
};
2016-05-30 16:55:32 -07:00
render() {
return <input type="text" id={this.props.forID} value={this.props.value || ''} onChange={this.handleChange} />;
2016-05-30 16:55:32 -07:00
}
}
StringControl.propTypes = {
onChange: PropTypes.func.isRequired,
forID: PropTypes.string,
value: PropTypes.node,
};