0
0
Fork 0

Change the title of spoiler button by state

The title will give the precise representation of the current state. It
would be helpful for blind people.
This commit is contained in:
Akihiko Odaki 2018-03-13 15:58:13 +09:00
parent fa5c867e0e
commit 0dccb398bd
39 changed files with 83 additions and 41 deletions

View file

@ -4,12 +4,13 @@ import { changeComposeSpoilerness } from '../../../actions/compose';
import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({
title: { id: 'compose_form.spoiler', defaultMessage: 'Hide text behind warning' },
marked: { id: 'compose_form.spoiler.marked', defaultMessage: 'Text is hidden behind warning' },
unmarked: { id: 'compose_form.spoiler.unmarked', defaultMessage: 'Text is not hidden' },
});
const mapStateToProps = (state, { intl }) => ({
label: 'CW',
title: intl.formatMessage(messages.title),
title: intl.formatMessage(state.getIn(['compose', 'spoiler']) ? messages.marked : messages.unmarked),
active: state.getIn(['compose', 'spoiler']),
ariaControls: 'cw-spoiler-input',
});