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.

LeaveReasonDialog.web.tsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React, { useEffect } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { makeStyles } from 'tss-react/mui';
  4. import Dialog from '../../../base/ui/components/web/Dialog';
  5. const useStyles = makeStyles()(theme => {
  6. return {
  7. dialog: {
  8. marginBottom: theme.spacing(1)
  9. },
  10. text: {
  11. fontSize: '20px'
  12. }
  13. };
  14. });
  15. /**
  16. * The type of the React {@code Component} props of {@link LeaveReasonDialog}.
  17. */
  18. interface IProps {
  19. /**
  20. * Callback invoked when {@code LeaveReasonDialog} is unmounted.
  21. */
  22. onClose: () => void;
  23. /**
  24. * The title to display in the dialog.
  25. */
  26. title?: string;
  27. }
  28. /**
  29. * A React {@code Component} for displaying a dialog with a reason that ended the conference.
  30. *
  31. * @param {IProps} props - Component's props.
  32. * @returns {JSX}
  33. */
  34. const LeaveReasonDialog = ({ onClose, title }: IProps) => {
  35. const { classes } = useStyles();
  36. const { t } = useTranslation();
  37. useEffect(() => () => {
  38. onClose?.();
  39. }, []);
  40. return (
  41. <Dialog
  42. cancel = {{ hidden: true }}
  43. onSubmit = { onClose }
  44. size = 'medium'
  45. testId = 'dialog.leaveReason'>
  46. <div className = { classes.dialog }>
  47. {title ? <div className = { classes.text }>{t(title)}</div> : null}
  48. </div>
  49. </Dialog>
  50. );
  51. };
  52. export default LeaveReasonDialog;