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.

ReloadButton.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React, { Component } from 'react';
  2. import { translate } from '../../base/i18n';
  3. import { reconnectNow } from '../functions';
  4. /**
  5. * Implements a React Component for button for the overlays that will reload
  6. * the page.
  7. */
  8. class ReloadButton extends Component {
  9. /**
  10. * PageReloadOverlay component's property types.
  11. *
  12. * @static
  13. */
  14. static propTypes = {
  15. /**
  16. * The function to translate human-readable text.
  17. *
  18. * @public
  19. * @type {Function}
  20. */
  21. t: React.PropTypes.func,
  22. /**
  23. * The translation key for the text in the button.
  24. *
  25. * @type {string}
  26. */
  27. textKey: React.PropTypes.string.isRequired
  28. }
  29. /**
  30. * Renders the button for relaod the page if necessary.
  31. *
  32. * @returns {ReactElement|null}
  33. * @private
  34. */
  35. render() {
  36. const className
  37. = 'button-control button-control_overlay button-control_center';
  38. const { t } = this.props;
  39. /* eslint-disable react/jsx-handler-names */
  40. return (
  41. <button
  42. className = { className }
  43. onClick = { reconnectNow }>
  44. { t(this.props.textKey) }
  45. </button>
  46. );
  47. /* eslint-enable react/jsx-handler-names */
  48. }
  49. }
  50. export default translate(ReloadButton);