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 #2239 from matrix-org/bwindels/topleftmenu1
Browse files Browse the repository at this point in the history
Redesign: 1st go at top left menu & restyling context menus
  • Loading branch information
bwindels committed Oct 23, 2018
2 parents 88df3d2 + 4b90fd5 commit 466062e
Show file tree
Hide file tree
Showing 17 changed files with 260 additions and 82 deletions.
3 changes: 2 additions & 1 deletion res/css/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@import "./structures/_RoomView.scss";
@import "./structures/_SearchBox.scss";
@import "./structures/_TagPanel.scss";
@import "./structures/_TopLeftMenu.scss";
@import "./structures/_TopLeftMenuButton.scss";
@import "./structures/_UploadBar.scss";
@import "./structures/_UserSettings.scss";
@import "./structures/_ViewSource.scss";
Expand All @@ -27,6 +27,7 @@
@import "./views/context_menus/_MessageContextMenu.scss";
@import "./views/context_menus/_RoomTileContextMenu.scss";
@import "./views/context_menus/_TagTileContextMenu.scss";
@import "./views/context_menus/_TopLeftMenu.scss";
@import "./views/dialogs/_BugReportDialog.scss";
@import "./views/dialogs/_ChangelogDialog.scss";
@import "./views/dialogs/_ChatCreateOrReuseChatDialog.scss";
Expand Down
17 changes: 10 additions & 7 deletions res/css/structures/_ContextualMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ limitations under the License.
}

.mx_ContextualMenu {
border: solid 1px $menu-border-color;
border-radius: 4px;
border-radius: 2px;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.21);
background-color: $menu-bg-color;
color: $primary-fg-color;
position: absolute;
padding: 6px;
font-size: 14px;
z-index: 5001;
}
Expand All @@ -44,14 +43,18 @@ limitations under the License.
right: 8px;
}

.mx_ContextualMenu_noChevron {
border-radius: unset !important;
}

.mx_ContextualMenu_chevron_right {
position: absolute;
right: -8px;
top: 0px;
width: 0;
height: 0;
border-top: 8px solid transparent;
border-left: 8px solid $menu-border-color;
border-left: 8px solid $menu-bg-color;
border-bottom: 8px solid transparent;
}

Expand All @@ -78,7 +81,7 @@ limitations under the License.
width: 0;
height: 0;
border-top: 8px solid transparent;
border-right: 8px solid $menu-border-color;
border-right: 8px solid $menu-bg-color;
border-bottom: 8px solid transparent;
}

Expand All @@ -105,7 +108,7 @@ limitations under the License.
width: 0;
height: 0;
border-left: 8px solid transparent;
border-bottom: 8px solid $menu-border-color;
border-bottom: 8px solid $menu-bg-color;
border-right: 8px solid transparent;
}

Expand All @@ -132,7 +135,7 @@ limitations under the License.
width: 0;
height: 0;
border-left: 8px solid transparent;
border-top: 8px solid $menu-border-color;
border-top: 8px solid $menu-bg-color;
border-right: 8px solid transparent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,31 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_TopLeftMenu {
.mx_TopLeftMenuButton {
height: 52px;
border-bottom: 1px solid $panel-divider-color;
color: $topleftmenu-color;
background-color: $primary-bg-color;
display: flex;
align-items: center;
min-width: 0;
padding: 0 7px;
overflow: hidden;
}

.mx_TopLeftMenu_avatar {
position: relative; // to get avatar in the right place
margin-left: 15px;
margin-right: 15px;
margin-top: 14px;
.mx_TopLeftMenuButton .mx_BaseAvatar {
margin: 0 7px;
}

.mx_TopLeftMenu_name {
margin-top: 15px;
margin-right: 9px;
.mx_TopLeftMenuButton_name {
margin: 0 7px;
font-size: 18px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
font-weight: 600;
}

.mx_TopLeftMenu_chevron {
margin-top: 24px;
.mx_TopLeftMenuButton_chevron {
margin: 0 7px;
}
4 changes: 4 additions & 0 deletions res/css/views/context_menus/_MessageContextMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_MessageContextMenu {
padding: 6px;
}

.mx_MessageContextMenu_field {
padding: 3px 6px 3px 6px;
cursor: pointer;
Expand Down
4 changes: 4 additions & 0 deletions res/css/views/context_menus/_RoomTileContextMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_RoomTileContextMenu {
padding: 6px;
}

.mx_RoomTileContextMenu_tag_field, .mx_RoomTileContextMenu_leave {
padding-top: 8px;
padding-right: 20px;
Expand Down
39 changes: 39 additions & 0 deletions res/css/views/context_menus/_TopLeftMenu.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Copyright 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_TopLeftMenu {
min-width: 180px;

.mx_TopLeftMenu_section:not(:last-child) {
border-bottom: 1px solid $menu-border-color;
}

.mx_TopLeftMenu_section {
list-style: none;
margin: 5px 0;
padding: 0;

li {
white-space: nowrap;
padding: 5px 20px;
}

li:hover {
background-color: $menu-selected-color;
}
}

}
4 changes: 2 additions & 2 deletions res/css/views/rooms/_RoomTooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
width: 0;
height: 0;
border-top: 8px solid transparent;
border-right: 8px solid $menu-border-color;
border-right: 8px solid $menu-bg-color;
border-bottom: 8px solid transparent;
}

Expand All @@ -40,8 +40,8 @@ limitations under the License.
.mx_RoomTooltip {
display: none;
position: fixed;
border: 1px solid $menu-border-color;
border-radius: 5px;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.21);
background-color: $primary-bg-color;
z-index: 2000;
padding: 5px;
Expand Down
4 changes: 3 additions & 1 deletion res/themes/dark/css/_dark.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// typical text (dark-on-white in light skin)
$primary-fg-color: #dddddd;
$primary-fg-color: #212121;
$primary-bg-color: #2d2d2d;

// used for focusing form controls
Expand Down Expand Up @@ -72,9 +72,11 @@ $input-fg-color: $primary-fg-color;
// context menus
$menu-border-color: rgba(187, 187, 187, 0.5);
$menu-bg-color: #373737;
$menu-selected-color: #f5f8fa;

$avatar-initial-color: #2d2d2d;
$avatar-bg-color: #ffffff;
$menu-selected-color: #f5f8fa;

$h3-color: $primary-fg-color;

Expand Down
5 changes: 3 additions & 2 deletions res/themes/dharma/css/_dharma.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ $input-underline-color: rgba(151, 151, 151, 0.5);
$input-fg-color: rgba(74, 74, 74, 0.9);

// context menus
$menu-border-color: rgba(187, 187, 187, 0.5);
$menu-bg-color: #f6f6f6;
$menu-border-color: #ebedf8;
$menu-bg-color: #fff;
$menu-selected-color: #f5f8fa;

$avatar-initial-color: #ffffff;
$avatar-bg-color: #ffffff;
Expand Down
1 change: 1 addition & 0 deletions res/themes/light/css/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ $input-fg-color: rgba(74, 74, 74, 0.9);
// context menus
$menu-border-color: rgba(187, 187, 187, 0.5);
$menu-bg-color: #f6f6f6;
$menu-selected-color: #f5f8fa;

$avatar-initial-color: #ffffff;
$avatar-bg-color: #ffffff;
Expand Down
8 changes: 5 additions & 3 deletions src/components/structures/ContextualMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class ContextualMenu extends React.Component {
menuHeight: PropTypes.number,
chevronOffset: PropTypes.number,
menuColour: PropTypes.string,
chevronFace: PropTypes.string, // top, bottom, left, right
chevronFace: PropTypes.string, // top, bottom, left, right or none
// Function to be called on menu close
onFinished: PropTypes.func,
menuPaddingTop: PropTypes.number,
Expand Down Expand Up @@ -113,7 +113,6 @@ export default class ContextualMenu extends React.Component {
render() {
const position = {};
let chevronFace = null;

const props = this.props;

if (props.top) {
Expand All @@ -137,6 +136,8 @@ export default class ContextualMenu extends React.Component {
if (props.chevronFace) {
chevronFace = props.chevronFace;
}
const hasChevron = chevronFace && chevronFace !== "none";

if (chevronFace === 'top' || chevronFace === 'bottom') {
chevronOffset.left = props.chevronOffset;
} else {
Expand Down Expand Up @@ -174,11 +175,12 @@ export default class ContextualMenu extends React.Component {
`;
}

const chevron = <div style={chevronOffset} className={"mx_ContextualMenu_chevron_" + chevronFace} />;
const chevron = hasChevron ? <div style={chevronOffset} className={"mx_ContextualMenu_chevron_" + chevronFace} /> : undefined;
const className = 'mx_ContextualMenu_wrapper';

const menuClasses = classNames({
'mx_ContextualMenu': true,
'mx_ContextualMenu_noChevron': chevronFace === 'none',
'mx_ContextualMenu_left': chevronFace === 'left',
'mx_ContextualMenu_right': chevronFace === 'right',
'mx_ContextualMenu_top': chevronFace === 'top',
Expand Down
4 changes: 2 additions & 2 deletions src/components/structures/LeftPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ var LeftPanel = React.createClass({
render: function() {
const RoomList = sdk.getComponent('rooms.RoomList');
const TagPanel = sdk.getComponent('structures.TagPanel');
const TopLeftMenu = sdk.getComponent('structures.TopLeftMenu');
const TopLeftMenuButton = sdk.getComponent('structures.TopLeftMenuButton');
const BottomLeftMenu = sdk.getComponent('structures.BottomLeftMenu');
const CallPreview = sdk.getComponent('voip.CallPreview');

let topBox = <TopLeftMenu collapsed={ this.props.collapsed }/>;
let topBox = <TopLeftMenuButton collapsed={ this.props.collapsed }/>;
/*
if (this.context.matrixClient.isGuest()) {
const LoginBox = sdk.getComponent('structures.LoginBox');
Expand Down
51 changes: 0 additions & 51 deletions src/components/structures/TopLeftMenu.js

This file was deleted.

Loading

0 comments on commit 466062e

Please sign in to comment.