Add optional tintable SVG icon for SimpleRoomHeader

This commit is contained in:
Luke Barnard 2017-04-27 17:57:13 +01:00
parent 786fa6b6e7
commit 0b06e979cb

View file

@ -19,6 +19,7 @@ limitations under the License.
import React from 'react'; import React from 'react';
import dis from '../../../dispatcher'; import dis from '../../../dispatcher';
import AccessibleButton from '../elements/AccessibleButton'; import AccessibleButton from '../elements/AccessibleButton';
import sdk from '../../../index';
// cancel button which is shared between room header and simple room header // cancel button which is shared between room header and simple room header
export function CancelButton(props) { export function CancelButton(props) {
@ -43,8 +44,8 @@ export default React.createClass({
title: React.PropTypes.string, title: React.PropTypes.string,
onCancelClick: React.PropTypes.func, onCancelClick: React.PropTypes.func,
// is the RightPanel collapsed? // `src` to a TintableSvg. Optional.
collapsedRhs: React.PropTypes.bool, icon: React.PropTypes.string,
}, },
onShowRhsClick: function(ev) { onShowRhsClick: function(ev) {
@ -53,9 +54,17 @@ export default React.createClass({
render: function() { render: function() {
let cancelButton; let cancelButton;
let icon;
if (this.props.onCancelClick) { if (this.props.onCancelClick) {
cancelButton = <CancelButton onClick={this.props.onCancelClick} />; cancelButton = <CancelButton onClick={this.props.onCancelClick} />;
} }
if (this.props.icon) {
const TintableSvg = sdk.getComponent('elements.TintableSvg');
icon = <TintableSvg
className="mx_RoomHeader_icon" src={this.props.icon}
width="25" height="25"
/>;
}
let showRhsButton; let showRhsButton;
/* // don't bother cluttering things up with this for now. /* // don't bother cluttering things up with this for now.
@ -73,6 +82,7 @@ export default React.createClass({
<div className="mx_RoomHeader" > <div className="mx_RoomHeader" >
<div className="mx_RoomHeader_wrapper"> <div className="mx_RoomHeader_wrapper">
<div className="mx_RoomHeader_simpleHeader"> <div className="mx_RoomHeader_simpleHeader">
{ icon }
{ this.props.title } { this.props.title }
{ showRhsButton } { showRhsButton }
{ cancelButton } { cancelButton }