add cancelButton to simpleHeader

pull/21833/head
Matthew Hodgson 2016-04-15 22:16:19 +01:00
parent 8ec13d2752
commit 19770563f4
3 changed files with 9 additions and 1 deletions

View File

@ -1025,6 +1025,7 @@ module.exports = React.createClass({
onUserSettingsClose: function() {
// XXX: use browser history instead to find the previous room?
// or maintain a this.state.pageHistory in _setPage()?
if (this.state.currentRoom) {
dis.dispatch({
action: 'view_room',

View File

@ -340,7 +340,7 @@ module.exports = React.createClass({
return (
<div className="mx_UserSettings">
<SimpleRoomHeader title="Settings"/>
<SimpleRoomHeader title="Settings" onCancelClick={ this.props.onClose }/>
<GeminiScrollbar className="mx_UserSettings_body" autoshow={true}>

View File

@ -27,14 +27,21 @@ module.exports = React.createClass({
propTypes: {
title: React.PropTypes.string,
onCancelClick: React.PropTypes.func,
},
render: function() {
var cancelButton;
if (this.props.onCancelClick) {
cancelButton = <div className="mx_RoomHeader_cancelButton" onClick={this.props.onCancelClick}><img src="img/cancel.svg" width="18" height="18" alt="Cancel"/> </div>
}
return (
<div className="mx_RoomHeader" >
<div className="mx_RoomHeader_wrapper">
<div className="mx_RoomHeader_simpleHeader">
{ this.props.title }
{ cancelButton }
</div>
</div>
</div>