2021-11-15 08:37:54 +00:00
|
|
|
import { withStyles } from '@material-ui/styles';
|
|
|
|
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-08-25 11:35:19 +00:00
|
|
|
classes: any,
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Attribute used in automated testing.
|
|
|
|
*/
|
|
|
|
dataTestId: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The button's icon.
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
icon: Function,
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The button's label.
|
|
|
|
*/
|
|
|
|
label: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to be called when button is clicked.
|
|
|
|
*/
|
2022-08-25 11:35:19 +00:00
|
|
|
onButtonClick: (e?: React.MouseEvent) => void,
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to be called on key pressed.
|
|
|
|
*/
|
2022-08-25 11:35:19 +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-08-25 11:35:19 +00:00
|
|
|
const styles = (theme: any) => {
|
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',
|
2021-11-15 08:37:54 +00:00
|
|
|
padding: '0 16px',
|
|
|
|
backgroundColor: theme.palette.field02,
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
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);
|