mirror of https://github.com/jitsi/jitsi-meet
feat: add custom buttons for participant menu and toolbar via config (#12832)
* add custom remote menu button * add config for custom buttons * whitelist custom buttons flag * add toolbox custom button * fix notify toolbox buttons * whitelist toolbar custom buttons * rename and fix notify * rename participant remote menu * revert some flag wrong changes * fix some formatings * add undefined type to custom buttons toolbox * code review * code review 2 * fix linting issuepull/12891/head jitsi-meet_8292
parent
3a5833829c
commit
1a113ba733
@ -0,0 +1,44 @@ |
||||
import React from 'react'; |
||||
|
||||
// eslint-disable-next-line lines-around-comment
|
||||
// @ts-ignore
|
||||
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components'; |
||||
|
||||
|
||||
type Props = AbstractButtonProps & { |
||||
icon: string; |
||||
text: string; |
||||
}; |
||||
|
||||
/** |
||||
* Component that renders a custom toolbox button. |
||||
* |
||||
* @returns {Component} |
||||
*/ |
||||
class CustomOptionButton extends AbstractButton<Props, any, any> { |
||||
// @ts-ignore
|
||||
iconSrc = this.props.icon; |
||||
|
||||
// @ts-ignore
|
||||
id = this.props.id; |
||||
|
||||
// @ts-ignore
|
||||
text = this.props.text; |
||||
|
||||
accessibilityLabel = this.text; |
||||
|
||||
/** |
||||
* Custom icon component. |
||||
* |
||||
* @param {any} props - Icon's props. |
||||
* @returns {img} |
||||
*/ |
||||
icon = (props: any) => (<img |
||||
src = { this.iconSrc } |
||||
{ ...props } />); |
||||
|
||||
label = this.text; |
||||
tooltip = this.text; |
||||
} |
||||
|
||||
export default CustomOptionButton; |
@ -0,0 +1,27 @@ |
||||
import React, { useCallback } from 'react'; |
||||
|
||||
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem'; |
||||
|
||||
const CustomOptionButton = ( |
||||
{ icon: iconSrc, onClick, text }: |
||||
{ |
||||
icon: string; |
||||
onClick: (e?: React.MouseEvent<Element, MouseEvent> | undefined) => void; |
||||
text: string; |
||||
} |
||||
) => { |
||||
|
||||
const icon = useCallback(props => (<img |
||||
src = { iconSrc } |
||||
{ ...props } />), [ iconSrc ]); |
||||
|
||||
return ( |
||||
<ContextMenuItem |
||||
accessibilityLabel = { text } |
||||
icon = { icon } |
||||
onClick = { onClick } |
||||
text = { text } /> |
||||
); |
||||
}; |
||||
|
||||
export default CustomOptionButton; |
Loading…
Reference in new issue