0
0
Fork 0

Disable sensitive button when with content warnings (#4460)

This commit is contained in:
Yamagishi Kazutoshi 2017-07-31 12:06:56 +09:00 committed by Eugen Rochko
parent e1fcad34a9
commit bb85043f46
3 changed files with 19 additions and 8 deletions

View file

@ -15,6 +15,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({
visible: state.getIn(['compose', 'media_attachments']).size > 0,
active: state.getIn(['compose', 'sensitive']),
disabled: state.getIn(['compose', 'spoiler']),
});
const mapDispatchToProps = dispatch => ({
@ -30,12 +31,13 @@ class SensitiveButton extends React.PureComponent {
static propTypes = {
visible: PropTypes.bool,
active: PropTypes.bool,
disabled: PropTypes.bool,
onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
render () {
const { visible, active, onClick, intl } = this.props;
const { visible, active, disabled, onClick, intl } = this.props;
return (
<Motion defaultStyle={{ scale: 0.87 }} style={{ scale: spring(visible ? 1 : 0.87, { stiffness: 200, damping: 3 }) }}>
@ -53,6 +55,7 @@ class SensitiveButton extends React.PureComponent {
onClick={onClick}
size={18}
active={active}
disabled={disabled}
style={{ lineHeight: null, height: null }}
inverted
/>