You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FaceExpressionsSwitch.tsx 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { makeStyles } from '@material-ui/core/styles';
  2. import React from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import Switch from '../../../base/ui/components/web/Switch';
  5. import { Theme } from '../../../base/ui/types';
  6. // @ts-ignore
  7. const useStyles = makeStyles((theme: Theme) => {
  8. return {
  9. switchContainer: {
  10. display: 'flex',
  11. alignItems: 'center'
  12. },
  13. switchLabel: {
  14. marginRight: 10,
  15. ...theme.typography.bodyShortRegular,
  16. lineHeight: `${theme.typography.bodyShortRegular.lineHeight}px`
  17. }
  18. };
  19. });
  20. /**
  21. * The type of the React {@code Component} props of {@link ToggleFaceExpressionsButton}.
  22. */
  23. type Props = {
  24. /**
  25. * The function to initiate the change in the speaker stats table.
  26. */
  27. onChange: (checked?: boolean) => void;
  28. /**
  29. * The state of the button.
  30. */
  31. showFaceExpressions: boolean;
  32. };
  33. /**
  34. * React component for toggling face expressions grid.
  35. *
  36. * @returns {React$Element<any>}
  37. */
  38. export default function FaceExpressionsSwitch({ onChange, showFaceExpressions }: Props) {
  39. const classes = useStyles();
  40. const { t } = useTranslation();
  41. return (
  42. <div className = { classes.switchContainer } >
  43. <label
  44. className = { classes.switchLabel }
  45. htmlFor = 'face-expressions-switch'>
  46. { t('speakerStats.displayEmotions')}
  47. </label>
  48. <Switch
  49. checked = { showFaceExpressions }
  50. id = 'face-expressions-switch'
  51. onChange = { onChange } />
  52. </div>
  53. );
  54. }