Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2226 from matrix-org/bwindels/resizeroomsublists
Browse files Browse the repository at this point in the history
Redesign: 1st go at resizing room sublists
  • Loading branch information
bwindels authored Oct 19, 2018
2 parents f2ee830 + bfbf41f commit 73d9a71
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 274 deletions.
15 changes: 12 additions & 3 deletions res/css/structures/_RoomSubList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ limitations under the License.
*/

.mx_RoomSubList {
display: table;
table-layout: fixed;
width: 100%;
min-height: 80px;
flex: 0;
display: flex;
flex-direction: column;
}

.mx_RoomSubList_hidden {
min-height: unset;
}

.mx_RoomSubList_resizer {
Expand Down Expand Up @@ -127,6 +131,11 @@ limitations under the License.
transform: rotateZ(-90deg);
}

.mx_RoomSubList .gm-scrollbar-container {
/* let rooms list grab all available space */
flex: 1;
}

.collapsed {
.mx_RoomSubList_label {
height: 17px;
Expand Down
20 changes: 6 additions & 14 deletions res/css/views/rooms/_RoomList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ limitations under the License.
*/

.mx_RoomList {
padding-bottom: 12px;
min-height: 400px;
/* take up remaining space below TopLeftMenu */
flex: 1;
/* use flexbox to layout sublists */
display: flex;
flex-direction: column;
}

.mx_RoomList_expandButton {
Expand All @@ -27,18 +30,6 @@ limitations under the License.
padding-right: 12px;
}

/* Evil hacky override until Chrome fixes drop and drag table cells
and we can correctly fix horizontal wrapping in the sidebar again */
.mx_RoomList_scrollbar .gm-scroll-view {
overflow-x: hidden ! important;
overflow-y: scroll ! important;
}

/* Make sure the scrollbar is above the sticky headers from RoomList */
.mx_RoomList_scrollbar .gm-scrollbar.-vertical {
z-index: 6;
}

.mx_RoomList_emptySubListTip_container {
background-color: $secondary-accent-color;
padding-left: 18px;
Expand All @@ -65,3 +56,4 @@ limitations under the License.
position: absolute;
right: 60px;
}

29 changes: 20 additions & 9 deletions src/components/structures/RoomSubList.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ limitations under the License.
import React from 'react';
import classNames from 'classnames';
import sdk from '../../index';
import { Droppable } from 'react-beautiful-dnd';
import { _t } from '../../languageHandler';
import dis from '../../dispatcher';
import Unread from '../../Unread';
import * as RoomNotifs from '../../RoomNotifs';
Expand Down Expand Up @@ -364,14 +362,27 @@ const RoomSubList = React.createClass({
}
}

if (this.state.sortedList.length > 0 || this.props.extraTiles.length > 0) {
const len = this.state.sortedList.length + this.props.extraTiles.length;

const subList = this.state.hidden ? undefined : content;

return <div className={"mx_RoomSubList"}>
{this._getHeaderJsx()}
{subList}
</div>;
if (len) {
if (this.state.hidden) {
return <div className={["mx_RoomSubList", "mx_RoomSubList_hidden"]}>
{this._getHeaderJsx()}
</div>;
} else {
const heightEstimation = (len * 40) + 31;
const style = {
flexBasis: `${heightEstimation}px`,
maxHeight: `${heightEstimation}px`,
};
const GeminiScrollbarWrapper = sdk.getComponent("elements.GeminiScrollbarWrapper");
return <div className={"mx_RoomSubList"} style={style}>
{this._getHeaderJsx()}
<GeminiScrollbarWrapper>
{ content }
</GeminiScrollbarWrapper>
</div>;
}
} else {
const Loader = sdk.getComponent("elements.Spinner");
if (this.props.showSpinner) {
Expand Down
Loading

0 comments on commit 73d9a71

Please sign in to comment.