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.

JoinButton.web.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // @flow
  2. import React, { Component } from 'react';
  3. import Tooltip from '@atlaskit/tooltip';
  4. import { translate } from '../../base/i18n';
  5. /**
  6. * The type of the React {@code Component} props of {@link JoinButton}.
  7. */
  8. type Props = {
  9. /**
  10. * The function called when the button is pressed.
  11. */
  12. onPress: Function,
  13. /**
  14. * The meeting URL associated with the {@link JoinButton} instance.
  15. */
  16. url: string,
  17. /**
  18. * Invoked to obtain translated strings.
  19. */
  20. t: Function
  21. };
  22. /**
  23. * A React Component for joining an existing calendar meeting.
  24. *
  25. * @extends Component
  26. */
  27. class JoinButton extends Component<Props> {
  28. /**
  29. * Initializes a new {@code JoinButton} instance.
  30. *
  31. * @param {*} props - The read-only properties with which the new instance
  32. * is to be initialized.
  33. */
  34. constructor(props) {
  35. super(props);
  36. // Bind event handler so it is only bound once for every instance.
  37. this._onClick = this._onClick.bind(this);
  38. }
  39. /**
  40. * Implements React's {@link Component#render}.
  41. *
  42. * @inheritdoc
  43. */
  44. render() {
  45. const { t } = this.props;
  46. return (
  47. <Tooltip
  48. content = { t('calendarSync.joinTooltip') }>
  49. <div
  50. className = 'button join-button'
  51. onClick = { this._onClick }>
  52. { t('calendarSync.join') }
  53. </div>
  54. </Tooltip>
  55. );
  56. }
  57. _onClick: (Object) => void;
  58. /**
  59. * Callback invoked when the component is clicked.
  60. *
  61. * @param {Object} event - The DOM click event.
  62. * @private
  63. * @returns {void}
  64. */
  65. _onClick(event) {
  66. this.props.onPress(event, this.props.url);
  67. }
  68. }
  69. export default translate(JoinButton);