Implement global filter to deselect all tags

and make TagPanel scrollable whilst we're at it.
This commit is contained in:
Luke Barnard 2018-02-16 17:43:24 +00:00
parent ad863afd6d
commit 113fc696d8

View file

@ -17,6 +17,7 @@ limitations under the License.
import React from 'react';
import PropTypes from 'prop-types';
import { MatrixClient } from 'matrix-js-sdk';
import GeminiScrollbar from 'react-gemini-scrollbar';
import TagOrderStore from '../../stores/TagOrderStore';
import GroupActions from '../../actions/GroupActions';
@ -93,9 +94,14 @@ const TagPanel = React.createClass({
dis.dispatch({action: 'view_create_group'});
},
onLogoClick(ev) {
dis.dispatch({action: 'deselect_tags'});
},
render() {
const GroupsButton = sdk.getComponent('elements.GroupsButton');
const DNDTagTile = sdk.getComponent('elements.DNDTagTile');
const AccessibleButton = sdk.getComponent('elements.AccessibleButton');
const tags = this.state.orderedTags.map((tag, index) => {
return <DNDTagTile
@ -106,6 +112,11 @@ const TagPanel = React.createClass({
/>;
});
return <div className="mx_TagPanel">
<AccessibleButton className="mx_TagPanel_logo" onClick={this.onLogoClick}>
<img src="img/logos/riot-logo.svg" />
</AccessibleButton>
<div className="mx_TagPanel_divider" />
<GeminiScrollbar autoShow={true} className="mx_TagPanel_scroller">
<Droppable
droppableId="tag-panel-droppable"
type="draggable-TagTile"
@ -125,6 +136,8 @@ const TagPanel = React.createClass({
</div>
) }
</Droppable>
</GeminiScrollbar>
<div className="mx_TagPanel_divider" />
<div className="mx_TagPanel_createGroupButton">
<GroupsButton tooltip={true} />
</div>