2021-01-12 13:24:55 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { Icon, IconClose } from '../../../base/icons';
|
|
|
|
import { connect } from '../../../base/redux';
|
2021-02-24 12:26:00 +00:00
|
|
|
import { toggleChat } from '../../actions.web';
|
2021-01-12 13:24:55 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function to be called when pressing the close button.
|
|
|
|
*/
|
|
|
|
onCancel: Function,
|
|
|
|
|
2021-01-14 16:12:08 +00:00
|
|
|
/**
|
|
|
|
* An optional class name.
|
|
|
|
*/
|
|
|
|
className: string,
|
2021-01-12 13:24:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom header of the {@code ChatDialog}.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
2021-03-18 07:08:34 +00:00
|
|
|
function Header({ onCancel, className }: Props) {
|
2021-01-12 13:24:55 +00:00
|
|
|
return (
|
|
|
|
<div
|
2021-01-14 16:12:08 +00:00
|
|
|
className = { className || 'chat-dialog-header' }>
|
2021-01-12 13:24:55 +00:00
|
|
|
<Icon
|
|
|
|
onClick = { onCancel }
|
|
|
|
src = { IconClose } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-02-24 12:26:00 +00:00
|
|
|
const mapDispatchToProps = { onCancel: toggleChat };
|
2021-01-12 13:24:55 +00:00
|
|
|
|
2021-03-18 07:08:34 +00:00
|
|
|
export default connect(null, mapDispatchToProps)(Header);
|