diff --git a/react/features/base/toolbox/components/AbstractButton.js b/react/features/base/toolbox/components/AbstractButton.js index 1bae56c1e7..2c88120da7 100644 --- a/react/features/base/toolbox/components/AbstractButton.js +++ b/react/features/base/toolbox/components/AbstractButton.js @@ -140,6 +140,17 @@ export default class AbstractButton extends Component { // To be implemented by subclass. } + /** + * Helper function to be implemented by subclasses, which may return a new + * React Element to be appended at the end of the button. + * + * @protected + * @returns {ReactElement|null} + */ + _getElementAfter() { + return null; + } + /** * Gets the current icon name, taking the toggled state into account. If no * toggled icon is provided, the regular icon will also be used in the @@ -243,6 +254,7 @@ export default class AbstractButton extends Component { const props = { ...this.props, accessibilityLabel: this.accessibilityLabel, + elementAfter: this._getElementAfter(), iconName: this._getIconName(), label: this._getLabel(), styles: this._getStyles(), diff --git a/react/features/base/toolbox/components/AbstractToolboxItem.js b/react/features/base/toolbox/components/AbstractToolboxItem.js index dad9371fd5..540f827d53 100644 --- a/react/features/base/toolbox/components/AbstractToolboxItem.js +++ b/react/features/base/toolbox/components/AbstractToolboxItem.js @@ -41,6 +41,11 @@ export type Props = { */ disabled: boolean, + /** + * A React Element to display at the end of {@code ToolboxItem}. + */ + elementAfter?: React$Node, + /** * The name of the icon of this {@code ToolboxItem}. */ diff --git a/react/features/base/toolbox/components/ToolboxItem.web.js b/react/features/base/toolbox/components/ToolboxItem.web.js index ffb3817ead..bfd985e117 100644 --- a/react/features/base/toolbox/components/ToolboxItem.web.js +++ b/react/features/base/toolbox/components/ToolboxItem.web.js @@ -22,6 +22,7 @@ export default class ToolboxItem extends AbstractToolboxItem { _renderItem() { const { disabled, + elementAfter, onClick, showLabel, tooltipPosition @@ -41,6 +42,7 @@ export default class ToolboxItem extends AbstractToolboxItem { { showLabel && { this.label } } + { elementAfter } ); diff --git a/react/features/recording/components/LiveStream/LiveStreamButton.web.js b/react/features/recording/components/LiveStream/LiveStreamButton.web.js index df508fa223..0b22d90d5f 100644 --- a/react/features/recording/components/LiveStream/LiveStreamButton.web.js +++ b/react/features/recording/components/LiveStream/LiveStreamButton.web.js @@ -1,5 +1,6 @@ // @flow +import React from 'react'; import { connect } from 'react-redux'; import { translate } from '../../../base/i18n'; @@ -56,6 +57,22 @@ class LiveStreamButton extends AbstractLiveStreamButton { this.tooltip = newProps._liveStreamDisabledTooltipKey; } + /** + * Helper function to be implemented by subclasses, which returns a React + * Element to display (a beta tag) at the end of the button. + * + * @override + * @protected + * @returns {boolean} + */ + _getElementAfter() { + return ( + + { this.props.t('recording.beta') } + + ); + } + /** * Helper function to be implemented by subclasses, which must return a * boolean value indicating if this button is disabled or not.