2022-09-13 07:36:00 +00:00
|
|
|
import { Theme } from '@mui/material';
|
|
|
|
import { withStyles } from '@mui/styles';
|
2021-11-15 08:37:54 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
import Icon from '../../base/icons/components/Icon';
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The css classes generated from theme.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
classes: any;
|
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;
|
2021-11-15 08:37:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates the styles for the component.
|
|
|
|
*
|
|
|
|
* @param {Object} theme - The current UI theme.
|
|
|
|
*
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2022-09-13 07:36:00 +00:00
|
|
|
const styles = (theme: 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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Buttons used for pre meeting actions.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
const DropdownButton = ({
|
|
|
|
classes,
|
|
|
|
dataTestId,
|
|
|
|
icon,
|
|
|
|
onButtonClick,
|
|
|
|
onKeyPressed,
|
|
|
|
label
|
|
|
|
}: Props) => (
|
|
|
|
<div
|
|
|
|
className = { classes.prejoinPreviewDropdownBtn }
|
|
|
|
data-testid = { dataTestId }
|
|
|
|
onClick = { onButtonClick }
|
|
|
|
onKeyPress = { onKeyPressed }
|
|
|
|
role = 'button'
|
|
|
|
tabIndex = { 0 }>
|
|
|
|
<Icon
|
|
|
|
className = { classes.prejoinPreviewDropdownIcon }
|
|
|
|
size = { 24 }
|
|
|
|
src = { icon } />
|
|
|
|
{label}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default withStyles(styles)(DropdownButton);
|