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

22 lines
478 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 {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(e) {
this.props.onChange(e.target.value);
}
render() {
2016-08-24 21:36:44 -03:00
return <input type="text" value={this.props.value || ''} onChange={this.handleChange}/>;
2016-05-30 16:55:32 -07:00
}
}
StringControl.propTypes = {
onChange: PropTypes.func.isRequired,
value: PropTypes.node,
};