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