Skip to content

Commit 1150e22

Browse files
committed
collapsible sublists
1 parent 886ffbf commit 1150e22

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎src/skins/vector/css/organisms/RoomSubList.css‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ limitations under the License.
3030
margin-top: 8px;
3131
margin-bottom: 4px;
3232
}
33+
34+
.mx_RoomSubList_chevron {
35+
padding-left: 5px;
36+
}

‎src/skins/vector/views/organisms/RoomSubList.js‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ var RoomSubList = React.createClass({
5858

5959
getInitialState: function() {
6060
return {
61+
hidden: false,
6162
sortedList: [],
6263
};
6364
},
@@ -71,6 +72,10 @@ var RoomSubList = React.createClass({
7172
this.sortList(newProps.list, newProps.order);
7273
},
7374

75+
onClick: function(ev) {
76+
this.setState({ hidden : !this.state.hidden });
77+
},
78+
7479
tsOfNewestEvent: function(room) {
7580
if (room.timeline.length) {
7681
return room.timeline[room.timeline.length - 1].getTs();
@@ -229,14 +234,22 @@ var RoomSubList = React.createClass({
229234
target = <RoomDropTarget label={ 'Drop here to ' + this.props.verb }/>;
230235
}
231236

237+
var subList;
238+
if (!this.state.hidden) {
239+
subList = <div className="mx_RoomSubList">
240+
{ target }
241+
{ this.makeRoomTiles() }
242+
</div>;
243+
}
244+
245+
232246
if (this.state.sortedList.length > 0 || this.props.editable) {
233247
return connectDropTarget(
234248
<div>
235-
<h2 className="mx_RoomSubList_label">{ this.props.collapsed ? '' : this.props.label }</h2>
236-
<div className="mx_RoomSubList">
237-
{ target }
238-
{ this.makeRoomTiles() }
239-
</div>
249+
<h2 onClick={ this.onClick } className="mx_RoomSubList_label">{ this.props.collapsed ? '' : this.props.label }
250+
<img className="mx_RoomSubList_chevron" src={ this.state.hidden ? "/img/list-open.png" : "/img/list-close.png" } width="10" height="10"/>
251+
</h2>
252+
{ subList }
240253
</div>
241254
);
242255
}

0 commit comments

Comments
 (0)