Added UrlInput component to tidy things up a little.

This commit is contained in:
orangemug
2019-10-27 17:08:23 +00:00
parent 663f295623
commit 566201fb45
8 changed files with 126 additions and 38 deletions

View File

@@ -8,10 +8,15 @@ class StringInput extends React.Component {
style: PropTypes.object,
default: PropTypes.string,
onChange: PropTypes.func,
onInput: PropTypes.func,
multi: PropTypes.bool,
required: PropTypes.bool,
}
static defaultProps = {
onInput: () => {},
}
constructor(props) {
super(props)
this.state = {
@@ -57,7 +62,9 @@ class StringInput extends React.Component {
this.setState({
editing: true,
value: e.target.value
})
}, () => {
this.props.onInput(this.state.value);
});
},
onBlur: () => {
if(this.state.value!==this.props.value) {