Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

LocalRecordingButton.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { translate } from '../../base/i18n';
  4. import { ToolbarButton } from '../../toolbox';
  5. /**
  6. * The type of the React {@code Component} state of
  7. * {@link LocalRecordingButton}.
  8. */
  9. type Props = {
  10. /**
  11. * Whether or not {@link LocalRecordingInfoDialog} should be displayed.
  12. */
  13. isDialogShown: boolean,
  14. /**
  15. * Callback function called when {@link LocalRecordingButton} is clicked.
  16. */
  17. onClick: Function,
  18. /**
  19. * Invoked to obtain translated strings.
  20. */
  21. t: Function
  22. }
  23. /**
  24. * A React {@code Component} for opening or closing the
  25. * {@code LocalRecordingInfoDialog}.
  26. *
  27. * @extends Component
  28. */
  29. class LocalRecordingButton extends Component<Props> {
  30. /**
  31. * Initializes a new {@code LocalRecordingButton} instance.
  32. *
  33. * @param {Object} props - The read-only properties with which the new
  34. * instance is to be initialized.
  35. */
  36. constructor(props: Props) {
  37. super(props);
  38. // Bind event handlers so they are only bound once per instance.
  39. this._onClick = this._onClick.bind(this);
  40. }
  41. /**
  42. * Implements React's {@link Component#render()}.
  43. *
  44. * @inheritdoc
  45. * @returns {ReactElement}
  46. */
  47. render() {
  48. const { isDialogShown, t } = this.props;
  49. const iconClasses
  50. = `icon-thumb-menu ${isDialogShown
  51. ? 'icon-rec toggled' : 'icon-rec'}`;
  52. return (
  53. <ToolbarButton
  54. accessibilityLabel
  55. = { t('toolbar.accessibilityLabel.localRecording') }
  56. iconName = { iconClasses }
  57. onClick = { this._onClick }
  58. tooltip = { t('localRecording.dialogTitle') } />
  59. );
  60. }
  61. _onClick: () => void;
  62. /**
  63. * Callback invoked when the Toolbar button is clicked.
  64. *
  65. * @private
  66. * @returns {void}
  67. */
  68. _onClick() {
  69. this.props.onClick();
  70. }
  71. }
  72. export default translate(LocalRecordingButton);