mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 01:28:36 +08:00
Closing after featuring and unfeaturing
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user