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