logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

setting_text.js (845B)


  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. }