You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
866 B
39 lines
866 B
8 years ago
|
import React from 'react';
|
||
8 years ago
|
import PropTypes from 'prop-types';
|
||
8 years ago
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||
|
|
||
8 years ago
|
class SettingText extends React.PureComponent {
|
||
8 years ago
|
|
||
8 years ago
|
constructor (props, context) {
|
||
|
super(props, context);
|
||
|
this.handleChange = this.handleChange.bind(this);
|
||
|
}
|
||
8 years ago
|
|
||
|
handleChange (e) {
|
||
|
this.props.onChange(this.props.settingKey, e.target.value)
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
|
render () {
|
||
|
const { settings, settingKey, label } = this.props;
|
||
|
|
||
|
return (
|
||
|
<input
|
||
|
className='setting-text'
|
||
|
value={settings.getIn(settingKey)}
|
||
|
onChange={this.handleChange}
|
||
|
placeholder={label}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
|
||
8 years ago
|
}
|
||
|
|
||
|
SettingText.propTypes = {
|
||
|
settings: ImmutablePropTypes.map.isRequired,
|
||
|
settingKey: PropTypes.array.isRequired,
|
||
|
label: PropTypes.string.isRequired,
|
||
|
onChange: PropTypes.func.isRequired
|
||
|
};
|
||
8 years ago
|
|
||
|
export default SettingText;
|