Skip to content

Commit 0561c5b

Browse files
author
Luke Barnard
committed
Swap ui_opacity for panel_disabled
Simplify the API for disabling panels in the UI. `mx_fadable_faded` is applied instead of setting opacity.
1 parent bd15a88 commit 0561c5b

4 files changed

Lines changed: 30 additions & 30 deletions

File tree

‎src/components/structures/LeftPanel.js‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
import React from 'react';
2020
import { DragDropContext } from 'react-dnd';
2121
import HTML5Backend from 'react-dnd-html5-backend';
22+
import classNames from 'classnames';
2223
import KeyCode from 'matrix-react-sdk/lib/KeyCode';
2324
import sdk from 'matrix-react-sdk';
2425
import dis from 'matrix-react-sdk/lib/dispatcher';
@@ -55,7 +56,7 @@ var LeftPanel = React.createClass({
5556
// We just need to update if any of these things change.
5657
if (
5758
this.props.collapsed !== nextProps.collapsed ||
58-
this.props.opacity !== nextProps.opacity
59+
this.props.disabled !== nextProps.disabled
5960
) {
6061
return true;
6162
}
@@ -176,21 +177,16 @@ var LeftPanel = React.createClass({
176177
topBox = <SearchBox collapsed={ this.props.collapsed } onSearch={ this.onSearch } />;
177178
}
178179

179-
let classes = "mx_LeftPanel mx_fadable";
180-
if (this.props.collapsed) {
181-
classes += " collapsed";
182-
}
180+
let classes = classNames(
181+
"mx_LeftPanel", "mx_fadable",
182+
{
183+
"collapsed": this.props.collapsed,
184+
"mx_fadable_faded": this.props.disabled,
185+
}
186+
);
183187

184188
return (
185-
<aside className={classes}
186-
style={{
187-
opacity: this.props.opacity,
188-
pointerEvents: this.props.opacity < 1.0 ? 'none' : undefined,
189-
}}
190-
onKeyDown={ this._onKeyDown }
191-
onFocus={ this._onFocus }
192-
onBlur={ this._onBlur }
193-
>
189+
<aside className={classes} onKeyDown={ this._onKeyDown } onFocus={ this._onFocus } onBlur={ this._onBlur }>
194190
{ topBox }
195191
<CallPreview ConferenceHandler={VectorConferenceHandler} />
196192
<RoomList

‎src/components/structures/RightPanel.js‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818

1919
import React from 'react';
2020
import PropTypes from 'prop-types';
21+
import classNames from 'classnames';
2122
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2223
import sdk from 'matrix-react-sdk';
2324
import dis from 'matrix-react-sdk/lib/dispatcher';
@@ -345,18 +346,16 @@ module.exports = React.createClass({
345346
);
346347
}
347348

348-
let classes = "mx_RightPanel mx_fadable";
349-
if (this.props.collapsed) {
350-
classes += " collapsed";
351-
}
349+
let classes = classNames(
350+
"mx_RightPanel", "mx_fadable",
351+
{
352+
"collapsed": this.props.collapsed,
353+
"mx_fadable_faded": this.props.disabled,
354+
}
355+
);
352356

353357
return (
354-
<aside className={classes}
355-
style={{
356-
opacity: this.props.opacity,
357-
pointerEvents: this.props.opacity < 1.0 ? 'none' : undefined,
358-
}}
359-
>
358+
<aside className={classes}>
360359
<div className="mx_RightPanel_header">
361360
<div className="mx_RightPanel_headerButtonGroup">
362361
{headerButtons}

‎src/components/structures/RoomDirectory.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ module.exports = React.createClass({
8989
});
9090

9191
// dis.dispatch({
92-
// action: 'ui_opacity',
93-
// sideOpacity: 0.3,
94-
// middleOpacity: 0.3,
92+
// action: 'panel_disable',
93+
// sideDisabled: true,
94+
// middleDisabled: true,
9595
// });
9696
},
9797

9898
componentWillUnmount: function() {
9999
// dis.dispatch({
100-
// action: 'ui_opacity',
101-
// sideOpacity: 1.0,
102-
// middleOpacity: 1.0,
100+
// action: 'panel_disable',
101+
// sideDisabled: false,
102+
// middleDisabled: false,
103103
// });
104104
if (this.filterTimeout) {
105105
clearTimeout(this.filterTimeout);

‎src/skins/vector/css/_common.scss‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ textarea {
8787
transition: opacity 0.2s ease-in-out;
8888
}
8989

90+
.mx_fadable.mx_fadable_faded {
91+
opacity: 0.3;
92+
pointer-events: none;
93+
}
94+
9095
/* XXX: critical hack to GeminiScrollbar to allow them to work in FF 42 and Chrome 48.
9196
Stop the scrollbar view from pushing out the container's overall sizing, which causes
9297
flexbox to adapt to the new size and cause the view to keep growing.

0 commit comments

Comments
 (0)