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.

InviteButton.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 { createToolbarEvent, sendAnalytics } from '../../../analytics';
  7. import { Icon, IconInviteMore } from '../../../base/icons';
  8. import { beginAddPeople } from '../../../invite';
  9. import ParticipantPaneBaseButton from './ParticipantPaneBaseButton';
  10. const useStyles = makeStyles(theme => {
  11. return {
  12. button: {
  13. width: '100%',
  14. '& > *:not(:last-child)': {
  15. marginRight: `${theme.spacing(2)}px`
  16. }
  17. }
  18. };
  19. });
  20. export const InviteButton = () => {
  21. const dispatch = useDispatch();
  22. const { t } = useTranslation();
  23. const styles = useStyles();
  24. const onInvite = useCallback(() => {
  25. sendAnalytics(createToolbarEvent('invite'));
  26. dispatch(beginAddPeople());
  27. }, [ dispatch ]);
  28. return (
  29. <ParticipantPaneBaseButton
  30. accessibilityLabel = { t('participantsPane.actions.invite') }
  31. className = { styles.button }
  32. onClick = { onInvite }
  33. primary = { true }>
  34. <Icon
  35. size = { 20 }
  36. src = { IconInviteMore } />
  37. <span>{t('participantsPane.actions.invite')}</span>
  38. </ParticipantPaneBaseButton>
  39. );
  40. };