MM-54399 Move resizable sidebar handles to not overlap scrollbars (#24491)
* MM-54399 Move resizable sidebar handles to not overlap scrollbars * Disable RHS resizing in mobile view * Fix snapshots --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Devin Binnie <devin.binnie@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
42e988132c
Коммит
86689b7ee6
@@ -9,6 +9,7 @@ import styled, {createGlobalStyle, css} from 'styled-components';
|
|||||||
|
|
||||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||||
|
|
||||||
|
import {getIsMobileView} from 'selectors/views/browser';
|
||||||
import {useGlobalState} from 'stores/hooks';
|
import {useGlobalState} from 'stores/hooks';
|
||||||
|
|
||||||
import type {CssVarKeyForResizable} from './constants';
|
import type {CssVarKeyForResizable} from './constants';
|
||||||
@@ -34,19 +35,15 @@ const Divider = styled.div<{isActive: boolean}>`
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 16px;
|
width: 12px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
cursor: col-resize;
|
cursor: col-resize;
|
||||||
&.left {
|
&.left {
|
||||||
right: -8px;
|
right: -12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.right {
|
|
||||||
left: -8px;
|
|
||||||
}
|
|
||||||
&::after {
|
&::after {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 6px;
|
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: ${({isActive}) => (isActive ? 'var(--sidebar-text-active-border)' : 'transparent')};
|
background-color: ${({isActive}) => (isActive ? 'var(--sidebar-text-active-border)' : 'transparent')};
|
||||||
@@ -103,6 +100,7 @@ function ResizableDivider({
|
|||||||
const cssVarKey = `--${props.globalCssVar}`;
|
const cssVarKey = `--${props.globalCssVar}`;
|
||||||
|
|
||||||
const currentUserID = useSelector(getCurrentUserId);
|
const currentUserID = useSelector(getCurrentUserId);
|
||||||
|
const isMobileView = useSelector(getIsMobileView);
|
||||||
|
|
||||||
const [isActive, setIsActive] = useState(false);
|
const [isActive, setIsActive] = useState(false);
|
||||||
const [width, setWidth] = useGlobalState<number | null>(null, `resizable_${name}:`, currentUserID);
|
const [width, setWidth] = useGlobalState<number | null>(null, `resizable_${name}:`, currentUserID);
|
||||||
@@ -242,7 +240,7 @@ function ResizableDivider({
|
|||||||
setWidth(null);
|
setWidth(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled || isMobileView) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,10 @@ import ResizableDivider from '../resizable_divider';
|
|||||||
|
|
||||||
interface Props extends HTMLAttributes<'div'> {
|
interface Props extends HTMLAttributes<'div'> {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
disabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ResizableLhs({
|
function ResizableLhs({
|
||||||
children,
|
children,
|
||||||
disabled,
|
|
||||||
id,
|
id,
|
||||||
className,
|
className,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
@@ -30,7 +28,6 @@ function ResizableLhs({
|
|||||||
<ResizableDivider
|
<ResizableDivider
|
||||||
name={'lhsResizeHandle'}
|
name={'lhsResizeHandle'}
|
||||||
globalCssVar={CssVarKeyForResizable.LHS}
|
globalCssVar={CssVarKeyForResizable.LHS}
|
||||||
disabled={disabled}
|
|
||||||
defaultWidth={DEFAULT_LHS_WIDTH}
|
defaultWidth={DEFAULT_LHS_WIDTH}
|
||||||
dir={ResizeDirection.LEFT}
|
dir={ResizeDirection.LEFT}
|
||||||
containerRef={containerRef}
|
containerRef={containerRef}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ exports[`components/Root Routes Should mount public product routes 1`] = `
|
|||||||
<Connect(Pluggable)
|
<Connect(Pluggable)
|
||||||
pluggableName="Global"
|
pluggableName="Global"
|
||||||
/>
|
/>
|
||||||
<withRouter(Connect(Component)) />
|
<withRouter(Connect(SidebarRight)) />
|
||||||
<AppBar />
|
<AppBar />
|
||||||
<Connect(SidebarRightMenu) />
|
<Connect(SidebarRightMenu) />
|
||||||
</CompassThemeProvider>
|
</CompassThemeProvider>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ exports[`components/sidebar should match empty div snapshot when teamId is missi
|
|||||||
exports[`components/sidebar should match snapshot 1`] = `
|
exports[`components/sidebar should match snapshot 1`] = `
|
||||||
<ResizableLhs
|
<ResizableLhs
|
||||||
className=""
|
className=""
|
||||||
disabled={false}
|
|
||||||
id="SidebarContainer"
|
id="SidebarContainer"
|
||||||
>
|
>
|
||||||
<SidebarHeader
|
<SidebarHeader
|
||||||
@@ -49,7 +48,6 @@ exports[`components/sidebar should match snapshot 1`] = `
|
|||||||
exports[`components/sidebar should match snapshot when direct channels modal is open 1`] = `
|
exports[`components/sidebar should match snapshot when direct channels modal is open 1`] = `
|
||||||
<ResizableLhs
|
<ResizableLhs
|
||||||
className=""
|
className=""
|
||||||
disabled={false}
|
|
||||||
id="SidebarContainer"
|
id="SidebarContainer"
|
||||||
>
|
>
|
||||||
<SidebarHeader
|
<SidebarHeader
|
||||||
@@ -97,7 +95,6 @@ exports[`components/sidebar should match snapshot when direct channels modal is
|
|||||||
exports[`components/sidebar should match snapshot when more channels modal is open 1`] = `
|
exports[`components/sidebar should match snapshot when more channels modal is open 1`] = `
|
||||||
<ResizableLhs
|
<ResizableLhs
|
||||||
className=""
|
className=""
|
||||||
disabled={false}
|
|
||||||
id="SidebarContainer"
|
id="SidebarContainer"
|
||||||
>
|
>
|
||||||
<SidebarHeader
|
<SidebarHeader
|
||||||
|
|||||||
@@ -234,8 +234,6 @@ export default class Sidebar extends React.PureComponent<Props, State> {
|
|||||||
'move--right': this.props.isOpen && this.props.isMobileView,
|
'move--right': this.props.isOpen && this.props.isMobileView,
|
||||||
dragging: this.state.isDragging,
|
dragging: this.state.isDragging,
|
||||||
})}
|
})}
|
||||||
disabled={this.props.isMobileView}
|
|
||||||
|
|
||||||
>
|
>
|
||||||
{this.props.isMobileView ? <MobileSidebarHeader/> : (
|
{this.props.isMobileView ? <MobileSidebarHeader/> : (
|
||||||
<SidebarHeader
|
<SidebarHeader
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import {memo} from 'react';
|
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {withRouter} from 'react-router-dom';
|
import {withRouter} from 'react-router-dom';
|
||||||
import type {RouteComponentProps} from 'react-router-dom';
|
import type {RouteComponentProps} from 'react-router-dom';
|
||||||
@@ -77,4 +76,4 @@ function mapDispatchToProps(dispatch: Dispatch) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(memo(SidebarRight)));
|
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(SidebarRight));
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import {isMac} from 'utils/user_agent';
|
|||||||
|
|
||||||
import type {RhsState} from 'types/store/rhs';
|
import type {RhsState} from 'types/store/rhs';
|
||||||
|
|
||||||
type Props = {
|
export type Props = {
|
||||||
isExpanded: boolean;
|
isExpanded: boolean;
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
channel: Channel;
|
channel: Channel;
|
||||||
|
|||||||
@@ -1757,7 +1757,6 @@
|
|||||||
|
|
||||||
.post__time,
|
.post__time,
|
||||||
.post-preview__time {
|
.post-preview__time {
|
||||||
margin-right: 4px;
|
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -404,11 +404,10 @@
|
|||||||
.post__permalink {
|
.post__permalink {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 2px;
|
top: 2px;
|
||||||
left: -18px;
|
left: -8px;
|
||||||
|
|
||||||
.sidebar--right & {
|
.sidebar--right & {
|
||||||
top: 1px;
|
top: 1px;
|
||||||
left: -18px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user