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.

25 lines
747 B

  1. import { connect } from 'react-redux';
  2. import TextIconButton from '../components/text_icon_button';
  3. import { changeComposeSpoilerness } from '../../../actions/compose';
  4. import { injectIntl, defineMessages } from 'react-intl';
  5. const messages = defineMessages({
  6. title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' },
  7. });
  8. const mapStateToProps = (state, { intl }) => ({
  9. label: 'CW',
  10. title: intl.formatMessage(messages.title),
  11. active: state.getIn(['compose', 'spoiler']),
  12. ariaControls: 'cw-spoiler-input',
  13. });
  14. const mapDispatchToProps = dispatch => ({
  15. onClick () {
  16. dispatch(changeComposeSpoilerness());
  17. },
  18. });
  19. export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(TextIconButton));