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