Newer
Older
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// @flow
import Droplist, { Item } from '@atlaskit/droplist';
import HelpIcon from '@atlaskit/icon/glyph/question-circle';
import React, { Component } from 'react';
import config from '../../config';
import { openExternalLink } from '../../utils';
type State = {
/**
* Whether the droplist is open or not.
*/
droplistOpen: boolean
};
/**
* Help Action for Navigation Bar.
*/
class HelpAction extends Component< *, State> {
/**
* Initializes a new {@code HelpAction} instance.
*
* @inheritdoc
*/
constructor() {
super();
this.state = {
droplistOpen: false
};
this._droplistToggle = this._droplistToggle.bind(this);
this._openPrivacyPage = this._openPrivacyPage.bind(this);
this._openTermsPage = this._openTermsPage.bind(this);
this._sendFeedback = this._sendFeedback.bind(this);
}
_droplistToggle: (*) => void;
/**
* Toggles the droplist.
*/
_droplistToggle() {
this.setState({
droplistOpen: !this.state.droplistOpen
});
}
_openPrivacyPage: (*) => void;
/**
* Opens Privacy Policy Page in default browser.
*/
_openPrivacyPage() {
openExternalLink(config.privacyPolicyURL);
}
_openTermsPage: (*) => void;
/**
* Opens Terms and Conditions Page in default browser.
*/
_openTermsPage() {
openExternalLink(config.termsAndConditionsURL);
}
_sendFeedback: (*) => void;
/**
* Opens Support/Feedback Email.
*/
_sendFeedback() {
openExternalLink(config.feedbackURL);
}
/**
* Render function of component.
*
* @return {ReactElement}
*/
render() {
return (
<Droplist
isOpen = { this.state.droplistOpen }
onClick = { () => this._droplistToggle() }
onOpenChange = { () => this._droplistToggle() }
position = 'right bottom'
trigger = { <HelpIcon /> }>
<Item onActivate = { this._openTermsPage }>Terms</Item>
<Item onActivate = { this._openPrivacyPage }>Privacy</Item>
<Item onActivate = { this._sendFeedback } >Send Feedback</Item>
</Droplist>
);
}
}
export default HelpAction;