Give descriptive key for slot elements and use it instead of talkPluginName

This commit is contained in:
Chi Vinh Le
2018-03-29 22:47:27 +02:00
parent 4a4c502fdd
commit 761e372016
9 changed files with 59 additions and 9247 deletions
@@ -14,10 +14,10 @@ import cn from 'classnames';
class Settings extends React.Component {
childFactory = el => {
const pluginName = el.type.talkPluginName;
const key = el.key;
const props = {
indicateOn: () => this.props.indicateOn(pluginName),
indicateOff: () => this.props.indicateOff(pluginName),
indicateOn: () => this.props.indicateOn(key),
indicateOff: () => this.props.indicateOff(key),
};
return React.cloneElement(el, props);
};
@@ -20,14 +20,14 @@ class SettingsContainer extends React.Component {
turnOffInput: {},
};
indicateOn = plugin =>
indicateOn = key =>
this.setState(state => ({
hasNotifications: state.hasNotifications.concat(plugin),
hasNotifications: state.hasNotifications.concat(key),
}));
indicateOff = plugin =>
indicateOff = key =>
this.setState(state => ({
hasNotifications: state.hasNotifications.filter(i => i !== plugin),
hasNotifications: state.hasNotifications.filter(i => i !== key),
}));
setTurnOffInputFragment = fragment =>