選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

DropdownButton.tsx 2.1KB

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