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.

31 lines
747 B

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import ImmutablePropTypes from 'react-immutable-proptypes';
  4. export default class SettingText extends React.PureComponent {
  5. static propTypes = {
  6. settings: ImmutablePropTypes.map.isRequired,
  7. settingKey: PropTypes.array.isRequired,
  8. label: PropTypes.string.isRequired,
  9. onChange: PropTypes.func.isRequired,
  10. };
  11. handleChange = (e) => {
  12. this.props.onChange(this.props.settingKey, e.target.value);
  13. }
  14. render () {
  15. const { settings, settingKey, label } = this.props;
  16. return (
  17. <input
  18. className='setting-text'
  19. value={settings.getIn(settingKey)}
  20. onChange={this.handleChange}
  21. placeholder={label}
  22. />
  23. );
  24. }
  25. }