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.

ChatDialogHeader.js 1009B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // @flow
  2. import React from 'react';
  3. import { translate } from '../../../base/i18n';
  4. import { Icon, IconClose } from '../../../base/icons';
  5. import { connect } from '../../../base/redux';
  6. import { toggleChat } from '../../../chat';
  7. type Props = {
  8. /**
  9. * Function to be called when pressing the close button.
  10. */
  11. onCancel: Function,
  12. /**
  13. * An optional class name.
  14. */
  15. className: string,
  16. /**
  17. * Invoked to obtain translated strings.
  18. */
  19. t: Function
  20. };
  21. /**
  22. * Custom header of the {@code ChatDialog}.
  23. *
  24. * @returns {React$Element<any>}
  25. */
  26. function Header({ onCancel, className, t }: Props) {
  27. return (
  28. <div
  29. className = { className || 'chat-dialog-header' }>
  30. { t('chat.title') }
  31. <Icon
  32. onClick = { onCancel }
  33. src = { IconClose } />
  34. </div>
  35. );
  36. }
  37. const mapDispatchToProps = { onCancel: toggleChat };
  38. export default translate(connect(null, mapDispatchToProps)(Header));