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.9KB

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