Skip to content

Commit 48e082e

Browse files
committed
Merge pull request element-hq#1402 from vector-im/matthew/design_tweaks
Matthew/design tweaks
2 parents 57c7d81 + c606912 commit 48e082e

31 files changed

Lines changed: 527 additions & 117 deletions

‎src/component-index.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ limitations under the License.
1919
* You can edit it you like, but your changes will be overwritten,
2020
* so you'd just be trying to swim upstream like a salmon.
2121
* You are not a salmon.
22+
*
23+
* To update it, run:
24+
* ./reskindex.js -h header
2225
*/
2326

2427
module.exports.components = require('matrix-react-sdk/lib/component-index').components;
@@ -29,6 +32,7 @@ module.exports.components['structures.LeftPanel'] = require('./components/struct
2932
module.exports.components['structures.RightPanel'] = require('./components/structures/RightPanel');
3033
module.exports.components['structures.RoomDirectory'] = require('./components/structures/RoomDirectory');
3134
module.exports.components['structures.RoomSubList'] = require('./components/structures/RoomSubList');
35+
module.exports.components['structures.SearchBox'] = require('./components/structures/SearchBox');
3236
module.exports.components['structures.ViewSource'] = require('./components/structures/ViewSource');
3337
module.exports.components['views.elements.ImageView'] = require('./components/views/elements/ImageView');
3438
module.exports.components['views.elements.Spinner'] = require('./components/views/elements/Spinner');

‎src/components/structures/BottomLeftMenu.js‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,19 @@ module.exports = React.createClass({
4747

4848
render: function() {
4949
var BottomLeftMenuTile = sdk.getComponent('rooms.BottomLeftMenuTile');
50+
var TintableSvg = sdk.getComponent('elements.TintableSvg');
5051
return (
5152
<div className="mx_BottomLeftMenu">
5253
<div className="mx_BottomLeftMenu_options">
53-
<BottomLeftMenuTile collapsed={ this.props.collapsed } img="img/create-big.svg" label="Start chat" onClick={ this.onCreateRoomClick }/>
54-
<BottomLeftMenuTile collapsed={ this.props.collapsed } img="img/directory-big.svg" label="Directory" onClick={ this.onRoomDirectoryClick }/>
55-
<BottomLeftMenuTile collapsed={ this.props.collapsed } img="img/settings-big.svg" label="Settings" onClick={ this.onSettingsClick }/>
54+
<div className="mx_BottomLeftMenu_createRoom" title="Start chat" onClick={ this.onCreateRoomClick }>
55+
<TintableSvg src="img/icons-create-room.svg" width="24" height="24"/>
56+
</div>
57+
<div className="mx_BottomLeftMenu_directory" title="Room directory" onClick={ this.onRoomDirectoryClick }>
58+
<TintableSvg src="img/icons-directory.svg" width="24" height="24"/>
59+
</div>
60+
<div className="mx_BottomLeftMenu_settings" title="Settings" onClick={ this.onSettingsClick }>
61+
<TintableSvg src="img/icons-settings.svg" width="24" height="24"/>
62+
</div>
5663
</div>
5764
</div>
5865
);

‎src/components/structures/LeftPanel.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var LeftPanel = React.createClass({
3131
getInitialState: function() {
3232
return {
3333
showCallElement: null,
34+
searchFilter: '',
3435
};
3536
},
3637

@@ -84,9 +85,14 @@ var LeftPanel = React.createClass({
8485
}
8586
},
8687

88+
onSearch: function(term) {
89+
this.setState({ searchFilter: term });
90+
},
91+
8792
render: function() {
8893
var RoomList = sdk.getComponent('rooms.RoomList');
8994
var BottomLeftMenu = sdk.getComponent('structures.BottomLeftMenu');
95+
var SearchBox = sdk.getComponent('structures.SearchBox');
9096

9197
var collapseButton;
9298
var classes = "mx_LeftPanel mx_fadable";
@@ -110,11 +116,13 @@ var LeftPanel = React.createClass({
110116

111117
return (
112118
<aside className={classes} style={{ opacity: this.props.opacity }}>
119+
<SearchBox collapsed={ this.props.collapsed } onSearch={ this.onSearch } />
113120
{ collapseButton }
114121
{ callPreview }
115122
<RoomList
116123
selectedRoom={this.props.selectedRoom}
117124
collapsed={this.props.collapsed}
125+
searchFilter={this.state.searchFilter}
118126
ConferenceHandler={VectorConferenceHandler} />
119127
<BottomLeftMenu collapsed={this.props.collapsed}/>
120128
</aside>

‎src/components/structures/RightPanel.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ module.exports = React.createClass({
155155
panel = <MemberInfo roomId={this.props.roomId} member={this.state.member} key={this.props.roomId} />
156156
}
157157
}
158+
}
158159

160+
if (!panel) {
161+
panel = <div className="mx_RightPanel_blank"></div>;
159162
}
160163

161164
var classes = "mx_RightPanel mx_fadable";
@@ -169,6 +172,8 @@ module.exports = React.createClass({
169172
{ buttonGroup }
170173
</div>
171174
{ panel }
175+
<div className="mx_RightPanel_footer">
176+
</div>
172177
</aside>
173178
);
174179
}

‎src/components/structures/RoomDirectory.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ module.exports = React.createClass({
4343
}
4444
},
4545

46+
componentWillMount: function() {
47+
// dis.dispatch({
48+
// action: 'ui_opacity',
49+
// sideOpacity: 0.3,
50+
// middleOpacity: 0.3,
51+
// });
52+
},
53+
4654
componentDidMount: function() {
4755
var self = this;
4856
MatrixClientPeg.get().publicRooms(function (err, data) {
@@ -65,6 +73,14 @@ module.exports = React.createClass({
6573
});
6674
},
6775

76+
componentWillUnmount: function() {
77+
// dis.dispatch({
78+
// action: 'ui_opacity',
79+
// sideOpacity: 1.0,
80+
// middleOpacity: 1.0,
81+
// });
82+
},
83+
6884
showRoom: function(roomId) {
6985
// extract the metadata from the publicRooms structure to pass
7086
// as out-of-band data to view_room, because we get information

‎src/components/structures/RoomSubList.js‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,12 @@ var RoomSubList = React.createClass({
6565
selectedRoom: React.PropTypes.string.isRequired,
6666
startAsHidden: React.PropTypes.bool,
6767
showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded
68-
69-
// TODO: Fix the name of this. This is too easily confused with the
70-
// "hidden" state which is the expanded (or not) view of the list of rooms.
71-
// What this prop *really* does is control whether the room name is displayed
72-
// so it should be named as such.
73-
collapsed: React.PropTypes.bool.isRequired,
68+
collapsed: React.PropTypes.bool.isRequired, // is LeftPanel collapsed?
7469
onHeaderClick: React.PropTypes.func,
7570
alwaysShowHeader: React.PropTypes.bool,
7671
incomingCall: React.PropTypes.object,
77-
onShowMoreRooms: React.PropTypes.func
72+
onShowMoreRooms: React.PropTypes.func,
73+
searchFilter: React.PropTypes.string,
7874
},
7975

8076
getInitialState: function() {
@@ -93,13 +89,20 @@ var RoomSubList = React.createClass({
9389
},
9490

9591
componentWillMount: function() {
96-
this.sortList(this.props.list, this.props.order);
92+
this.sortList(this.applySearchFilter(this.props.list, this.props.searchFilter), this.props.order);
9793
},
9894

9995
componentWillReceiveProps: function(newProps) {
10096
// order the room list appropriately before we re-render
10197
//if (debug) console.log("received new props, list = " + newProps.list);
102-
this.sortList(newProps.list, newProps.order);
98+
this.sortList(this.applySearchFilter(newProps.list, newProps.searchFilter), newProps.order);
99+
},
100+
101+
applySearchFilter: function(list, filter) {
102+
if (filter === "") return list;
103+
return list.filter((room) => {
104+
return room.name && room.name.toLowerCase().indexOf(filter.toLowerCase()) >= 0
105+
});
103106
},
104107

105108
onClick: function(ev) {
@@ -278,7 +281,7 @@ var RoomSubList = React.createClass({
278281
return (
279282
<h2 onClick={ this.onClick } className="mx_RoomSubList_label">
280283
{ this.props.collapsed ? '' : this.props.label }
281-
<TintableSvg className="mx_RoomSubList_chevron"
284+
<img className="mx_RoomSubList_chevron"
282285
src={ this.state.hidden ? "img/list-close.svg" : "img/list-open.svg" }
283286
width="10" height="10" />
284287
</h2>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
Copyright 2015, 2016 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
var React = require('react');
20+
var sdk = require('matrix-react-sdk')
21+
var dis = require('matrix-react-sdk/lib/dispatcher');
22+
var rate_limited_func = require('matrix-react-sdk/lib/ratelimitedfunc');
23+
24+
module.exports = React.createClass({
25+
displayName: 'SearchBox',
26+
27+
propTypes: {
28+
collapsed: React.PropTypes.bool,
29+
onSearch: React.PropTypes.func,
30+
},
31+
32+
onChange: new rate_limited_func(
33+
function() {
34+
if (this.refs.search) {
35+
this.props.onSearch(this.refs.search.value);
36+
}
37+
},
38+
100
39+
),
40+
41+
onToggleCollapse: function(show) {
42+
if (show) {
43+
dis.dispatch({
44+
action: 'show_left_panel',
45+
});
46+
}
47+
else {
48+
dis.dispatch({
49+
action: 'hide_left_panel',
50+
});
51+
}
52+
},
53+
54+
render: function() {
55+
var TintableSvg = sdk.getComponent('elements.TintableSvg');
56+
57+
var toggleCollapse;
58+
if (this.props.collapsed) {
59+
toggleCollapse =
60+
<div className="mx_SearchBox_maximise" onClick={ this.onToggleCollapse.bind(this, true) }>
61+
<TintableSvg src="img/maximise.svg" width="10" height="16" alt="&lt;"/>
62+
</div>
63+
}
64+
else {
65+
toggleCollapse =
66+
<div className="mx_SearchBox_minimise" onClick={ this.onToggleCollapse.bind(this, false) }>
67+
<TintableSvg src="img/minimise.svg" width="10" height="16" alt="&lt;"/>
68+
</div>
69+
}
70+
71+
var searchControls;
72+
if (!this.props.collapsed) {
73+
searchControls = [
74+
<TintableSvg
75+
key="button"
76+
className="mx_SearchBox_searchButton"
77+
src="img/right_search.svg" width="24" height="24"
78+
/>,
79+
<input
80+
key="searchfield"
81+
type="text"
82+
ref="search"
83+
className="mx_SearchBox_search"
84+
onChange={ this.onChange }
85+
placeholder="Search room names"
86+
/>
87+
];
88+
}
89+
90+
var self = this;
91+
return (
92+
<div className="mx_SearchBox">
93+
{ searchControls }
94+
{ toggleCollapse }
95+
</div>
96+
);
97+
}
98+
});

‎src/skins/vector/css/matrix-react-sdk/structures/RoomStatusBar.css‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1+
/*
2+
Copyright 2015, 2016 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
.mx_RoomStatusBar {
2-
margin-top: 5px;
18+
margin-top: 15px;
319
margin-left: 65px;
4-
min-height: 24px;
20+
min-height: 34px;
521
}
622

723
/* position the indicator in the same place horizontally as .mx_EventTile_avatar. */
@@ -17,8 +33,9 @@
1733
.mx_RoomStatusBar_placeholderIndicator span {
1834
color: #4a4a4a;
1935
opacity: 0.5;
20-
/*
2136
position: relative;
37+
top: -4px;
38+
/*
2239
animation-duration: 1s;
2340
animation-name: bounce;
2441
animation-direction: alternate;
@@ -99,7 +116,7 @@
99116
.mx_RoomStatusBar_tabCompleteWrapper {
100117
display: flex;
101118
display: -webkit-flex;
102-
height: 24px;
119+
height: 26px;
103120
}
104121

105122
.mx_RoomStatusBar_tabCompleteWrapper .mx_TabCompleteBar {

‎src/skins/vector/css/matrix-react-sdk/structures/RoomView.css‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ limitations under the License.
3636
-webkit-order: 1;
3737
order: 1;
3838

39-
-webkit-flex: 0 0 83px;
40-
flex: 0 0 83px;
39+
-webkit-flex: 0 0 70px;
40+
flex: 0 0 70px;
4141
}
4242

4343
.mx_RoomView_fileDropTarget {
@@ -64,7 +64,7 @@ limitations under the License.
6464
border: 2px #e1dddd solid;
6565
border-bottom: none;
6666
position: absolute;
67-
top: 83px;
67+
top: 70px;
6868
bottom: 0px;
6969
z-index: 3000;
7070
}
@@ -89,7 +89,7 @@ limitations under the License.
8989
margin: auto;
9090

9191
overflow: auto;
92-
border-bottom: 1px solid #ccc;
92+
border-bottom: 1px solid #e5e5e5;
9393

9494
-webkit-flex: 0 0 auto;
9595
flex: 0 0 auto;
@@ -158,7 +158,7 @@ limitations under the License.
158158
margin-bottom: 8px;
159159
margin-left: 63px;
160160
padding-bottom: 6px;
161-
border-bottom: 1px solid #eee;
161+
border-bottom: 1px solid #e5e5e5;
162162
}
163163

164164
.mx_RoomView_invitePrompt {
@@ -207,11 +207,12 @@ hr.mx_RoomView_myReadMarker {
207207
.mx_RoomView_statusAreaBox {
208208
max-width: 960px;
209209
margin: auto;
210-
min-height: 36px;
210+
min-height: 60px;
211211
}
212212

213213
.mx_RoomView_statusAreaBox_line {
214-
border-top: 1px solid #eee;
214+
margin-left: 65px;
215+
border-top: 1px solid #e5e5e5;
215216
height: 1px;
216217
}
217218

0 commit comments

Comments
 (0)