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