Hide sticker picker delete button and show minimise button.

pull/21833/head
Richard Lewis 2018-03-08 17:20:42 +00:00
parent c59dd5b840
commit 3ab8b1f866
3 changed files with 23 additions and 5 deletions

View File

@ -49,6 +49,7 @@ export default class AppTile extends React.Component {
this._onDeleteClick = this._onDeleteClick.bind(this); this._onDeleteClick = this._onDeleteClick.bind(this);
this._onSnapshotClick = this._onSnapshotClick.bind(this); this._onSnapshotClick = this._onSnapshotClick.bind(this);
this.onClickMenuBar = this.onClickMenuBar.bind(this); this.onClickMenuBar = this.onClickMenuBar.bind(this);
this._onMinimiseClick = this._onMinimiseClick.bind(this);
} }
/** /**
@ -448,6 +449,12 @@ export default class AppTile extends React.Component {
); );
} }
_onMinimiseClick(e) {
if (this.props.onMinimiseClick) {
this.props.onMinimiseClick();
}
}
render() { render() {
let appTileBody; let appTileBody;
@ -536,13 +543,14 @@ export default class AppTile extends React.Component {
<div className={this.props.fullWidth ? "mx_AppTileFullWidth" : "mx_AppTile"} id={this.props.id}> <div className={this.props.fullWidth ? "mx_AppTileFullWidth" : "mx_AppTile"} id={this.props.id}>
{ this.props.showMenubar && { this.props.showMenubar &&
<div ref="menu_bar" className="mx_AppTileMenuBar" onClick={this.onClickMenuBar}> <div ref="menu_bar" className="mx_AppTileMenuBar" onClick={this.onClickMenuBar}>
<span className="mx_AppTileMenuBarTitle"> <span className="mx_AppTileMenuBarTitle" style={{pointerEvents: (this.props.handleMinimisePointerEvents ? 'all' : false)}}>
{ this.props.showMinimise && <TintableSvgButton { this.props.showMinimise && <TintableSvgButton
src={windowStateIcon} src={windowStateIcon}
className="mx_AppTileMenuBarWidget mx_AppTileMenuBarWidgetPadding" className="mx_AppTileMenuBarWidget mx_AppTileMenuBarWidgetPadding"
title={_t('Minimize apps')} title={_t('Minimize apps')}
width="10" width="10"
height="10" height="10"
onClick={this._onMinimiseClick}
/> } /> }
{ this.props.showTitle && this._getTileTitle() } { this.props.showTitle && this._getTileTitle() }
</span> </span>
@ -568,14 +576,14 @@ export default class AppTile extends React.Component {
/> } /> }
{ /* Delete widget */ } { /* Delete widget */ }
<TintableSvgButton { this.props.showDelete && <TintableSvgButton
src={deleteIcon} src={deleteIcon}
className={deleteClasses} className={deleteClasses}
title={_t(deleteWidgetLabel)} title={_t(deleteWidgetLabel)}
onClick={this._onDeleteClick} onClick={this._onDeleteClick}
width="10" width="10"
height="10" height="10"
/> /> }
</span> </span>
</div> } </div> }
{ appTileBody } { appTileBody }
@ -607,10 +615,16 @@ AppTile.propTypes = {
onEditClick: PropTypes.func, onEditClick: PropTypes.func,
// Optional onDeleteClickHandler (overrides default behaviour) // Optional onDeleteClickHandler (overrides default behaviour)
onDeleteClick: PropTypes.func, onDeleteClick: PropTypes.func,
// Optional onMinimiseClickHandler
onMinimiseClick: PropTypes.func,
// Optionally hide the tile title // Optionally hide the tile title
showTitle: PropTypes.bool, showTitle: PropTypes.bool,
// Optionally hide the tile minimise icon // Optionally hide the tile minimise icon
showMinimise: PropTypes.bool, showMinimise: PropTypes.bool,
// Optionally handle minimise button pointer events (default false)
handleMinimisePointerEvents: PropTypes.bool,
// Optionally hide the delete icon
showDelete: PropTypes.bool,
}; };
AppTile.defaultProps = { AppTile.defaultProps = {
@ -619,4 +633,6 @@ AppTile.defaultProps = {
showMenubar: true, showMenubar: true,
showTitle: true, showTitle: true,
showMinimise: true, showMinimise: true,
showDelete: true,
handleMinimisePointerEvents: false,
}; };

View File

@ -96,7 +96,6 @@ export default class MStickerBody extends MImageBody {
} }
placeholderSize = placeholderSize + 'px'; placeholderSize = placeholderSize + 'px';
console.warn('placeholder classes', this.state.placeholderClasses);
return ( return (
<span className='mx_MStickerBody' ref='body' <span className='mx_MStickerBody' ref='body'

View File

@ -155,7 +155,10 @@ export default class Stickerpicker extends React.Component {
onEditClick={this._launchManageIntegrations} onEditClick={this._launchManageIntegrations}
onDeleteClick={this._removeStickerpickerWidgets} onDeleteClick={this._removeStickerpickerWidgets}
showTitle={false} showTitle={false}
showMinimise={false} showMinimise={true}
showDelete={false}
onMinimiseClick={this.onHideStickersClick}
handleMinimisePointerEvents={true}
/> />
</div> </div>
</div> </div>