Fix minor UI issues with composer

This commit is contained in:
Fedor Indutny 2022-06-15 10:53:08 -07:00 committed by GitHub
parent 3b2000a0ba
commit 4b8cb9f040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 172 additions and 114 deletions

View file

@ -40,6 +40,8 @@ type StateType = {
};
export class MainHeader extends React.Component<PropsType, StateType> {
public containerRef: React.RefObject<HTMLDivElement> = React.createRef();
constructor(props: PropsType) {
super(props);
@ -55,18 +57,14 @@ export class MainHeader extends React.Component<PropsType, StateType> {
if (
showingAvatarPopup &&
popperRoot &&
!popperRoot.contains(target as Node)
!popperRoot.contains(target as Node) &&
!this.containerRef.current?.contains(target as Node)
) {
this.hideAvatarPopup();
}
};
public showAvatarPopup = (
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
): void => {
event.preventDefault();
event.stopPropagation();
public showAvatarPopup = (): void => {
const popperRoot = document.createElement('div');
document.body.appendChild(popperRoot);
@ -142,7 +140,10 @@ export class MainHeader extends React.Component<PropsType, StateType> {
<Manager>
<Reference>
{({ ref }) => (
<div className="module-main-header__avatar--container">
<div
className="module-main-header__avatar--container"
ref={this.containerRef}
>
<Avatar
acceptedMessageRequest
avatarPath={avatarPath}