闭社主体 forked from https://github.com/tootsuite/mastodon
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.

34 lines
845 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. <label>
  18. <span style={{ display: 'none' }}>{label}</span>
  19. <input
  20. className='setting-text'
  21. value={settings.getIn(settingKey)}
  22. onChange={this.handleChange}
  23. placeholder={label}
  24. />
  25. </label>
  26. );
  27. }
  28. }