The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

48 lines
1013 B

  1. import PropTypes from 'prop-types';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. const style = {
  4. display: 'block',
  5. fontFamily: 'inherit',
  6. marginBottom: '10px',
  7. padding: '7px 0',
  8. boxSizing: 'border-box',
  9. width: '100%'
  10. };
  11. class SettingText extends React.PureComponent {
  12. constructor (props, context) {
  13. super(props, context);
  14. this.handleChange = this.handleChange.bind(this);
  15. }
  16. handleChange (e) {
  17. this.props.onChange(this.props.settingKey, e.target.value)
  18. }
  19. render () {
  20. const { settings, settingKey, label } = this.props;
  21. return (
  22. <input
  23. style={style}
  24. className='setting-text'
  25. value={settings.getIn(settingKey)}
  26. onChange={this.handleChange}
  27. placeholder={label}
  28. />
  29. );
  30. }
  31. }
  32. SettingText.propTypes = {
  33. settings: ImmutablePropTypes.map.isRequired,
  34. settingKey: PropTypes.array.isRequired,
  35. label: PropTypes.string.isRequired,
  36. onChange: PropTypes.func.isRequired
  37. };
  38. export default SettingText;