Add EnableNotificationButton component
This commit is contained in:
parent
c2ae6238b9
commit
8bde761a8a
1 changed files with 22 additions and 4 deletions
|
@ -15,10 +15,12 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
var sdk = require('../../index');
|
var React = require("react");
|
||||||
var dis = require("../../dispatcher");
|
var sdk = require('../../../index');
|
||||||
|
var dis = require("../../../dispatcher");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = React.createClass({
|
||||||
|
displayName: 'EnableNotificationsButton',
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
this.dispatcherRef = dis.register(this.onAction);
|
||||||
|
@ -55,4 +57,20 @@ module.exports = {
|
||||||
}
|
}
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
},
|
},
|
||||||
};
|
|
||||||
|
render: function() {
|
||||||
|
if (this.enabled()) {
|
||||||
|
return (
|
||||||
|
<button className="mx_EnableNotificationsButton" onClick={this.onClick}>
|
||||||
|
Disable Notifications
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<button className="mx_EnableNotificationsButton" onClick={this.onClick}>
|
||||||
|
Enable Notifications
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue