chinwagsocial/app/javascript/mastodon/features/compose/containers/spoiler_button_container.js

26 lines
747 B
JavaScript
Raw Normal View History

2017-03-25 10:01:43 +11: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({
title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' },
2017-03-25 10:01:43 +11:00
});
const mapStateToProps = (state, { intl }) => ({
label: 'CW',
title: intl.formatMessage(messages.title),
active: state.getIn(['compose', 'spoiler']),
ariaControls: 'cw-spoiler-input',
2017-03-25 10:01:43 +11:00
});
const mapDispatchToProps = dispatch => ({
onClick () {
dispatch(changeComposeSpoilerness());
},
2017-03-25 10:01:43 +11:00
});
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(TextIconButton));