Closing after featuring and unfeaturing

This commit is contained in:
Belen Curcio
2017-09-12 13:30:15 -03:00
parent 0042767fad
commit dbeca830a2
2 changed files with 22 additions and 3 deletions
@@ -29,12 +29,23 @@ export class ModActionButton extends React.Component {
});
}
handleDeleteTag = () => {
this.props.deleteTag();
this.props.closeTooltip();
}
handlePostTag = () => {
this.props.postTag();
this.props.closeTooltip();
}
render() {
const {alreadyTagged, deleteTag, postTag} = this.props;
const {alreadyTagged} = this.props;
const {handleDeleteTag, handlePostTag} = this;
return (
<button className={cn(`${pluginName}-tag-button`, styles.button, {[styles.featured] : alreadyTagged})}
onClick={alreadyTagged ? deleteTag : postTag}
onClick={alreadyTagged ? handleDeleteTag : handlePostTag}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave} >
@@ -1,9 +1,17 @@
import {compose} from 'react-apollo';
import {bindActionCreators} from 'redux';
import ModActionButton from '../components/ModActionButton';
import {withTags} from 'plugin-api/beta/client/hocs';
import {withTags, connect} from 'plugin-api/beta/client/hocs';
import {closeTooltip} from 'plugins/talk-plugin-moderation-actions/client/actions';
const mapDispatchToProps = (dispatch) =>
bindActionCreators({
closeTooltip,
}, dispatch);
const enhance = compose(
withTags('featured'),
connect(null, mapDispatchToProps),
);
export default enhance(ModActionButton);