You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HelpButton.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // @flow
  2. import { createToolbarEvent, sendAnalytics } from '../../../analytics';
  3. import { translate } from '../../../base/i18n';
  4. import { IconHelp } from '../../../base/icons';
  5. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox';
  6. declare var interfaceConfig: Object;
  7. /**
  8. * Implements an {@link AbstractButton} to open the user documentation in a new window.
  9. */
  10. class HelpButton extends AbstractButton<AbstractButtonProps, *> {
  11. accessibilityLabel = 'toolbar.accessibilityLabel.help';
  12. icon = IconHelp;
  13. label = 'toolbar.help';
  14. /**
  15. * Handles clicking / pressing the button, and opens a new window with the user documentation.
  16. *
  17. * @private
  18. * @returns {void}
  19. */
  20. _handleClick() {
  21. sendAnalytics(createToolbarEvent('help.pressed'));
  22. window.open(interfaceConfig.HELP_LINK);
  23. }
  24. /**
  25. * Implements React's {@link Component#render()}.
  26. *
  27. * @inheritdoc
  28. * @returns {React$Node}
  29. */
  30. render(): React$Node {
  31. if (typeof interfaceConfig.HELP_LINK === 'string') {
  32. return super.render();
  33. }
  34. return null;
  35. }
  36. }
  37. export default translate(HelpButton);