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.

40 lines
1.1 KiB

  1. import PropTypes from 'prop-types';
  2. import ImmutablePropTypes from 'react-immutable-proptypes';
  3. import emojify from '../../../emoji';
  4. import Toggle from 'react-toggle';
  5. class StatusCheckBox extends React.PureComponent {
  6. render () {
  7. const { status, checked, onToggle, disabled } = this.props;
  8. const content = { __html: emojify(status.get('content')) };
  9. if (status.get('reblog')) {
  10. return null;
  11. }
  12. return (
  13. <div className='status-check-box' style={{ display: 'flex' }}>
  14. <div
  15. className='status__content'
  16. style={{ flex: '1 1 auto', padding: '10px' }}
  17. dangerouslySetInnerHTML={content}
  18. />
  19. <div style={{ flex: '0 0 auto', padding: '10px', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
  20. <Toggle checked={checked} onChange={onToggle} disabled={disabled} />
  21. </div>
  22. </div>
  23. );
  24. }
  25. }
  26. StatusCheckBox.propTypes = {
  27. status: ImmutablePropTypes.map.isRequired,
  28. checked: PropTypes.bool,
  29. onToggle: PropTypes.func.isRequired,
  30. disabled: PropTypes.bool
  31. };
  32. export default StatusCheckBox;