2021-11-15 08:37:54 +00:00
|
|
|
import React from 'react';
|
2022-10-17 09:28:04 +00:00
|
|
|
import { makeStyles } from 'tss-react/mui';
|
2021-11-15 08:37:54 +00:00
|
|
|
|
2022-10-28 10:07:58 +00:00
|
|
|
import Icon from '../../../base/icons/components/Icon';
|
2021-11-15 08:37:54 +00:00
|
|
|
|
2022-11-03 08:35:51 +00:00
|
|
|
interface IProps {
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attribute used in automated testing.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
dataTestId: string;
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The button's icon.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
icon: Function;
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The button's label.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
label: string;
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to be called when button is clicked.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
onButtonClick: (e?: React.MouseEvent) => void;
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to be called on key pressed.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
onKeyPressed: (e?: React.KeyboardEvent) => void;
|
2022-11-03 08:35:51 +00:00
|
|
|
}
|
2021-11-15 08:37:54 +00:00
|
|
|
|
2022-10-17 09:28:04 +00:00
|
|
|
|
2022-11-15 07:50:22 +00:00
|
|
|
const useStyles = makeStyles()(theme => {
|
2021-11-15 08:37:54 +00:00
|
|
|
return {
|
|
|
|
prejoinPreviewDropdownBtn: {
|
|
|
|
alignItems: 'center',
|
|
|
|
color: '#1C2025',
|
|
|
|
cursor: 'pointer',
|
|
|
|
display: 'flex',
|
|
|
|
height: 40,
|
|
|
|
fontSize: 15,
|
2021-12-08 07:53:19 +00:00
|
|
|
lineHeight: '24px',
|
2022-09-13 07:36:00 +00:00
|
|
|
padding: '0 16px', // @ts-ignore
|
2021-11-15 08:37:54 +00:00
|
|
|
backgroundColor: theme.palette.field02,
|
|
|
|
|
2022-09-13 07:36:00 +00:00
|
|
|
'&:hover': { // @ts-ignore
|
2021-11-15 08:37:54 +00:00
|
|
|
backgroundColor: theme.palette.field02Hover
|
|
|
|
}
|
|
|
|
},
|
|
|
|
prejoinPreviewDropdownIcon: {
|
|
|
|
display: 'inline-block',
|
|
|
|
marginRight: 16,
|
|
|
|
|
|
|
|
'& > svg': {
|
|
|
|
fill: '#1C2025'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2022-10-17 09:28:04 +00:00
|
|
|
});
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Buttons used for pre meeting actions.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
const DropdownButton = ({
|
|
|
|
dataTestId,
|
|
|
|
icon,
|
|
|
|
onButtonClick,
|
|
|
|
onKeyPressed,
|
|
|
|
label
|
2022-11-03 08:35:51 +00:00
|
|
|
}: IProps) => {
|
2022-10-17 09:28:04 +00:00
|
|
|
const { classes } = useStyles();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className = { classes.prejoinPreviewDropdownBtn }
|
|
|
|
data-testid = { dataTestId }
|
|
|
|
onClick = { onButtonClick }
|
|
|
|
onKeyPress = { onKeyPressed }
|
|
|
|
role = 'button'
|
|
|
|
tabIndex = { 0 }>
|
|
|
|
<Icon
|
|
|
|
className = { classes.prejoinPreviewDropdownIcon }
|
|
|
|
color = '#1C2025'
|
|
|
|
size = { 24 }
|
|
|
|
src = { icon } />
|
|
|
|
{label}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2021-11-15 08:37:54 +00:00
|
|
|
|
2022-10-17 09:28:04 +00:00
|
|
|
export default DropdownButton;
|