2017-03-25 00:01:43 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import TextIconButton from '../components/text_icon_button';
|
2017-11-18 04:11:18 +01:00
|
|
|
import { changeComposeSpoilerness } from 'themes/glitch/actions/compose';
|
2017-03-25 00:01:43 +01:00
|
|
|
import { injectIntl, defineMessages } from 'react-intl';
|
|
|
|
|
|
|
|
const messages = defineMessages({
|
2017-05-20 17:31:47 +02:00
|
|
|
title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' },
|
2017-03-25 00:01:43 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapStateToProps = (state, { intl }) => ({
|
|
|
|
label: 'CW',
|
|
|
|
title: intl.formatMessage(messages.title),
|
2017-04-23 20:33:44 +02:00
|
|
|
active: state.getIn(['compose', 'spoiler']),
|
2017-05-20 17:31:47 +02:00
|
|
|
ariaControls: 'cw-spoiler-input',
|
2017-03-25 00:01:43 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => ({
|
|
|
|
|
|
|
|
onClick () {
|
|
|
|
dispatch(changeComposeSpoilerness());
|
2017-05-20 17:31:47 +02:00
|
|
|
},
|
2017-03-25 00:01:43 +01:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(TextIconButton));
|