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.

LeaveButton.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // @flow
  2. import { makeStyles } from '@material-ui/styles';
  3. import React, { useCallback } from 'react';
  4. import { useTranslation } from 'react-i18next';
  5. import { useDispatch } from 'react-redux';
  6. import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
  7. import ParticipantPaneBaseButton from '../../../participants-pane/components/web/ParticipantPaneBaseButton';
  8. import { moveToRoom } from '../../actions';
  9. const useStyles = makeStyles(theme => {
  10. return {
  11. button: {
  12. color: theme.palette.textError,
  13. backgroundColor: 'transparent',
  14. width: '100%',
  15. '&:hover': {
  16. backgroundColor: 'transparent'
  17. }
  18. }
  19. };
  20. });
  21. export const LeaveButton = () => {
  22. const { t } = useTranslation();
  23. const dispatch = useDispatch();
  24. const styles = useStyles();
  25. const onLeave = useCallback(() => {
  26. sendAnalytics(createBreakoutRoomsEvent('leave'));
  27. dispatch(moveToRoom());
  28. }, [ dispatch ]);
  29. return (
  30. <ParticipantPaneBaseButton
  31. accessibilityLabel = { t('breakoutRooms.actions.leaveBreakoutRoom') }
  32. className = { styles.button }
  33. onClick = { onLeave }>
  34. {t('breakoutRooms.actions.leaveBreakoutRoom')}
  35. </ParticipantPaneBaseButton>
  36. );
  37. };