forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreaction-picker-controller.js
More file actions
37 lines (31 loc) · 1.08 KB
/
reaction-picker-controller.js
File metadata and controls
37 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import PropTypes from 'prop-types';
import ReactionPickerView from '../views/reaction-picker-view';
import {RefHolderPropType} from '../prop-types';
import {addEvent} from '../reporter-proxy';
export default class ReactionPickerController extends React.Component {
static propTypes = {
addReaction: PropTypes.func.isRequired,
removeReaction: PropTypes.func.isRequired,
tooltipHolder: RefHolderPropType.isRequired,
}
render() {
return (
<ReactionPickerView
addReactionAndClose={this.addReactionAndClose}
removeReactionAndClose={this.removeReactionAndClose}
{...this.props}
/>
);
}
addReactionAndClose = async content => {
await this.props.addReaction(content);
addEvent('add-emoji-reaction', {package: 'github'});
this.props.tooltipHolder.map(tooltip => tooltip.dispose());
}
removeReactionAndClose = async content => {
await this.props.removeReaction(content);
addEvent('remove-emoji-reaction', {package: 'github'});
this.props.tooltipHolder.map(tooltip => tooltip.dispose());
}
}