Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

DropdownButton.tsx 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import React from 'react';
  2. import { makeStyles } from 'tss-react/mui';
  3. import Icon from '../../../base/icons/components/Icon';
  4. interface IProps {
  5. /**
  6. * Attribute used in automated testing.
  7. */
  8. dataTestId: string;
  9. /**
  10. * The button's icon.
  11. */
  12. icon: Function;
  13. /**
  14. * The button's label.
  15. */
  16. label: string;
  17. /**
  18. * Function to be called when button is clicked.
  19. */
  20. onButtonClick: (e?: React.MouseEvent) => void;
  21. /**
  22. * Function to be called on key pressed.
  23. */
  24. onKeyPressed: (e?: React.KeyboardEvent) => void;
  25. }
  26. const useStyles = makeStyles()(theme => {
  27. return {
  28. prejoinPreviewDropdownBtn: {
  29. alignItems: 'center',
  30. color: '#1C2025',
  31. cursor: 'pointer',
  32. display: 'flex',
  33. height: 40,
  34. fontSize: 15,
  35. lineHeight: '24px',
  36. padding: '0 16px', // @ts-ignore
  37. backgroundColor: theme.palette.field02,
  38. '&:hover': { // @ts-ignore
  39. backgroundColor: theme.palette.field02Hover
  40. }
  41. },
  42. prejoinPreviewDropdownIcon: {
  43. display: 'inline-block',
  44. marginRight: 16,
  45. '& > svg': {
  46. fill: '#1C2025'
  47. }
  48. }
  49. };
  50. });
  51. /**
  52. * Buttons used for pre meeting actions.
  53. *
  54. * @returns {ReactElement}
  55. */
  56. const DropdownButton = ({
  57. dataTestId,
  58. icon,
  59. onButtonClick,
  60. onKeyPressed,
  61. label
  62. }: IProps) => {
  63. const { classes } = useStyles();
  64. return (
  65. <div
  66. className = { classes.prejoinPreviewDropdownBtn }
  67. data-testid = { dataTestId }
  68. onClick = { onButtonClick }
  69. onKeyPress = { onKeyPressed }
  70. role = 'button'
  71. tabIndex = { 0 }>
  72. <Icon
  73. className = { classes.prejoinPreviewDropdownIcon }
  74. color = '#1C2025'
  75. size = { 24 }
  76. src = { icon } />
  77. {label}
  78. </div>
  79. );
  80. };
  81. export default DropdownButton;