| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- /* @flow */
-
- import React, { Component } from 'react';
-
- import { translate } from '../../base/i18n';
- import { ToolbarButton } from '../../toolbox';
-
- /**
- * The type of the React {@code Component} state of
- * {@link LocalRecordingButton}.
- */
- type Props = {
-
- /**
- * Whether or not {@link LocalRecordingInfoDialog} should be displayed.
- */
- isDialogShown: boolean,
-
- /**
- * Callback function called when {@link LocalRecordingButton} is clicked.
- */
- onClick: Function,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
- }
-
- /**
- * A React {@code Component} for opening or closing the
- * {@code LocalRecordingInfoDialog}.
- *
- * @extends Component
- */
- class LocalRecordingButton extends Component<Props> {
-
- /**
- * Initializes a new {@code LocalRecordingButton} instance.
- *
- * @param {Object} props - The read-only properties with which the new
- * instance is to be initialized.
- */
- constructor(props: Props) {
- super(props);
-
- // Bind event handlers so they are only bound once per instance.
- this._onClick = this._onClick.bind(this);
- }
-
- /**
- * Implements React's {@link Component#render()}.
- *
- * @inheritdoc
- * @returns {ReactElement}
- */
- render() {
- const { isDialogShown, t } = this.props;
- const iconClasses
- = `icon-thumb-menu ${isDialogShown
- ? 'icon-rec toggled' : 'icon-rec'}`;
-
- return (
- <ToolbarButton
- accessibilityLabel
- = { t('toolbar.accessibilityLabel.localRecording') }
- iconName = { iconClasses }
- onClick = { this._onClick }
- tooltip = { t('localRecording.dialogTitle') } />
- );
- }
-
- _onClick: () => void;
-
- /**
- * Callback invoked when the Toolbar button is clicked.
- *
- * @private
- * @returns {void}
- */
- _onClick() {
- this.props.onClick();
- }
- }
-
- export default translate(LocalRecordingButton);
|