2017-04-21 14:05:35 -04:00
|
|
|
import PropTypes from 'prop-types';
|
2023-05-28 10:38:10 -04:00
|
|
|
import { PureComponent } from 'react';
|
|
|
|
|
2017-01-10 11:25:10 -05:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
|
|
|
2023-05-28 08:18:23 -04:00
|
|
|
export default class SettingText extends PureComponent {
|
2017-01-10 11:25:10 -05:00
|
|
|
|
2017-05-12 08:44:10 -04:00
|
|
|
static propTypes = {
|
|
|
|
settings: ImmutablePropTypes.map.isRequired,
|
2017-12-26 14:21:20 -05:00
|
|
|
settingPath: PropTypes.array.isRequired,
|
2017-05-12 08:44:10 -04:00
|
|
|
label: PropTypes.string.isRequired,
|
2017-05-20 11:31:47 -04:00
|
|
|
onChange: PropTypes.func.isRequired,
|
2017-05-12 08:44:10 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
handleChange = (e) => {
|
2017-12-26 14:21:20 -05:00
|
|
|
this.props.onChange(this.props.settingPath, e.target.value);
|
2023-02-03 14:52:07 -05:00
|
|
|
};
|
2017-01-10 11:25:10 -05:00
|
|
|
|
|
|
|
render () {
|
2017-12-26 14:21:20 -05:00
|
|
|
const { settings, settingPath, label } = this.props;
|
2017-01-10 11:25:10 -05:00
|
|
|
|
|
|
|
return (
|
2017-07-27 18:54:48 -04:00
|
|
|
<label>
|
|
|
|
<span style={{ display: 'none' }}>{label}</span>
|
|
|
|
<input
|
|
|
|
className='setting-text'
|
2017-12-26 14:21:20 -05:00
|
|
|
value={settings.getIn(settingPath)}
|
2017-07-27 18:54:48 -04:00
|
|
|
onChange={this.handleChange}
|
|
|
|
placeholder={label}
|
|
|
|
/>
|
|
|
|
</label>
|
2017-01-10 11:25:10 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-04-21 14:05:35 -04:00
|
|
|
}
|