Make stories accessible with collapsed left pane
This commit is contained in:
parent
a3877ef747
commit
4bbf5eb5d4
3 changed files with 30 additions and 15 deletions
|
@ -2481,6 +2481,8 @@ button.ConversationDetails__action-button {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.module-left-pane--width-narrow & {
|
.module-left-pane--width-narrow & {
|
||||||
|
flex-direction: column;
|
||||||
|
height: auto;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2499,7 +2501,9 @@ button.ConversationDetails__action-button {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.module-left-pane--width-narrow & {
|
.module-left-pane--width-narrow & {
|
||||||
display: none;
|
margin-bottom: 28px;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2517,6 +2521,10 @@ button.ConversationDetails__action-button {
|
||||||
|
|
||||||
&__icon-container {
|
&__icon-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
.module-left-pane--width-narrow & {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__compose-icon {
|
&__compose-icon {
|
||||||
|
@ -2616,7 +2624,9 @@ button.ConversationDetails__action-button {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
|
|
||||||
.module-left-pane--width-narrow & {
|
.module-left-pane--width-narrow & {
|
||||||
display: none;
|
margin-right: 0;
|
||||||
|
margin-top: 28px;
|
||||||
|
margin-bottom: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@include light-theme {
|
@include light-theme {
|
||||||
|
|
|
@ -54,17 +54,7 @@ let closeCurrentOpenContextMenu: undefined | (() => unknown);
|
||||||
// right under the mouse cursor.
|
// right under the mouse cursor.
|
||||||
function generateVirtualElement(x: number, y: number): VirtualElement {
|
function generateVirtualElement(x: number, y: number): VirtualElement {
|
||||||
return {
|
return {
|
||||||
getBoundingClientRect: () => ({
|
getBoundingClientRect: () => new DOMRect(x, y),
|
||||||
bottom: y,
|
|
||||||
height: 0,
|
|
||||||
left: x,
|
|
||||||
right: x,
|
|
||||||
toJSON: () => ({ x, y }),
|
|
||||||
top: y,
|
|
||||||
width: 0,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2018 Signal Messenger, LLC
|
// Copyright 2018 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import type { VirtualElement } from '@popperjs/core';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Manager, Popper, Reference } from 'react-popper';
|
import { Manager, Popper, Reference } from 'react-popper';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
@ -40,8 +41,20 @@ type StateType = {
|
||||||
showingAvatarPopup: boolean;
|
showingAvatarPopup: boolean;
|
||||||
popperRoot: HTMLDivElement | null;
|
popperRoot: HTMLDivElement | null;
|
||||||
outsideClickDestructor?: () => void;
|
outsideClickDestructor?: () => void;
|
||||||
|
virtualElement: {
|
||||||
|
getBoundingClientRect: () => DOMRect;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://popper.js.org/docs/v2/virtual-elements/
|
||||||
|
// Generating a virtual element here so that we can make the menu pop up
|
||||||
|
// right under the mouse cursor.
|
||||||
|
function generateVirtualElement(x: number, y: number): VirtualElement {
|
||||||
|
return {
|
||||||
|
getBoundingClientRect: () => new DOMRect(x, y),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export class MainHeader extends React.Component<PropsType, StateType> {
|
export class MainHeader extends React.Component<PropsType, StateType> {
|
||||||
public containerRef: React.RefObject<HTMLDivElement> = React.createRef();
|
public containerRef: React.RefObject<HTMLDivElement> = React.createRef();
|
||||||
|
|
||||||
|
@ -51,10 +64,11 @@ export class MainHeader extends React.Component<PropsType, StateType> {
|
||||||
this.state = {
|
this.state = {
|
||||||
showingAvatarPopup: false,
|
showingAvatarPopup: false,
|
||||||
popperRoot: null,
|
popperRoot: null,
|
||||||
|
virtualElement: generateVirtualElement(0, 0),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public showAvatarPopup = (): void => {
|
public showAvatarPopup = (ev: React.MouseEvent): void => {
|
||||||
const popperRoot = document.createElement('div');
|
const popperRoot = document.createElement('div');
|
||||||
document.body.appendChild(popperRoot);
|
document.body.appendChild(popperRoot);
|
||||||
|
|
||||||
|
@ -79,6 +93,7 @@ export class MainHeader extends React.Component<PropsType, StateType> {
|
||||||
showingAvatarPopup: true,
|
showingAvatarPopup: true,
|
||||||
popperRoot,
|
popperRoot,
|
||||||
outsideClickDestructor,
|
outsideClickDestructor,
|
||||||
|
virtualElement: generateVirtualElement(ev.clientX, ev.clientY),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -187,7 +202,7 @@ export class MainHeader extends React.Component<PropsType, StateType> {
|
||||||
</Reference>
|
</Reference>
|
||||||
{showingAvatarPopup && popperRoot
|
{showingAvatarPopup && popperRoot
|
||||||
? createPortal(
|
? createPortal(
|
||||||
<Popper placement="bottom-end">
|
<Popper referenceElement={this.state.virtualElement}>
|
||||||
{({ ref, style }) => (
|
{({ ref, style }) => (
|
||||||
<AvatarPopup
|
<AvatarPopup
|
||||||
acceptedMessageRequest
|
acceptedMessageRequest
|
||||||
|
|
Loading…
Add table
Reference in a new issue