formatted files

This commit is contained in:
Agusti Bau 2020-05-02 13:25:18 +02:00
parent a84a3c4780
commit baa9cd8078
2 changed files with 50 additions and 50 deletions

View file

@ -19,7 +19,7 @@ import TagTile from './TagTile';
import React from 'react'; import React from 'react';
import { Draggable } from 'react-beautiful-dnd'; import { Draggable } from 'react-beautiful-dnd';
import {ContextMenu, toRightOf, useContextMenu} from "../../structures/ContextMenu"; import { ContextMenu, toRightOf, useContextMenu } from "../../structures/ContextMenu";
import * as sdk from '../../../index'; import * as sdk from '../../../index';
export default function DNDTagTile(props) { export default function DNDTagTile(props) {
@ -35,28 +35,28 @@ export default function DNDTagTile(props) {
</ContextMenu> </ContextMenu>
); );
} }
return <div> return <div>
<Draggable <Draggable
key={props.tag} key={props.tag}
draggableId={props.tag} draggableId={props.tag}
index={props.index} index={props.index}
type="draggable-TagTile" type="draggable-TagTile"
> >
{ (provided, snapshot) => ( {(provided, snapshot) => (
<div <div
ref={provided.innerRef} ref={provided.innerRef}
{...provided.draggableProps} {...provided.draggableProps}
{...provided.dragHandleProps} {...provided.dragHandleProps}
> >
<TagTile <TagTile
{...props} {...props}
contextMenuButtonRef= {handle} contextMenuButtonRef={handle}
menuDisplayed={menuDisplayed} menuDisplayed={menuDisplayed}
openMenu={openMenu} openMenu={openMenu}
/> />
</div> </div>
) } )}
</Draggable> </Draggable>
{contextMenu} {contextMenu}
</div>; </div>;
} }

View file

@ -84,7 +84,7 @@ export default createReactClass({
this.props.tag, this.props.tag,
).then((profile) => { ).then((profile) => {
if (this.unmounted) return; if (this.unmounted) return;
this.setState({profile}); this.setState({ profile });
}).catch((err) => { }).catch((err) => {
console.warn('Could not fetch group profile for ' + this.props.tag, err); console.warn('Could not fetch group profile for ' + this.props.tag, err);
}); });
@ -111,18 +111,18 @@ export default createReactClass({
}, },
onMouseOver: function() { onMouseOver: function() {
this.setState({hover: true}); this.setState({ hover: true });
}, },
onMouseOut: function() { onMouseOut: function() {
this.setState({hover: false}); this.setState({ hover: false });
}, },
openMenu: function(e) { openMenu: function(e) {
// Prevent the TagTile onClick event firing as well // Prevent the TagTile onClick event firing as well
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.setState({hover: false}); this.setState({ hover: false });
this.props.openMenu(); this.props.openMenu();
}, },
@ -154,32 +154,32 @@ export default createReactClass({
// FIXME: this ought to use AccessibleButton for a11y but that causes onMouseOut/onMouseOver to fire too much // FIXME: this ought to use AccessibleButton for a11y but that causes onMouseOut/onMouseOver to fire too much
const contextButton = this.state.hover || this.props.menuDisplayed ? const contextButton = this.state.hover || this.props.menuDisplayed ?
<div className="mx_TagTile_context_button" onClick={this.openMenu} ref={this.props.contextMenuButtonRef}> <div className="mx_TagTile_context_button" onClick={this.openMenu} ref={this.props.contextMenuButtonRef}>
{ "\u00B7\u00B7\u00B7" } {"\u00B7\u00B7\u00B7"}
</div> : <div ref={this.props.contextMenuButtonRef} />; </div> : <div ref={this.props.contextMenuButtonRef} />;
const AccessibleTooltipButton = sdk.getComponent("elements.AccessibleTooltipButton"); const AccessibleTooltipButton = sdk.getComponent("elements.AccessibleTooltipButton");
return <AccessibleTooltipButton return <AccessibleTooltipButton
className={className} className={className}
onClick={this.onClick} onClick={this.onClick}
onContextMenu={this.openMenu} onContextMenu={this.openMenu}
title={name} title={name}
>
<div
className="mx_TagTile_avatar"
onMouseOver={this.onMouseOver}
onMouseOut={this.onMouseOut}
> >
<div <BaseAvatar
className="mx_TagTile_avatar" name={name}
onMouseOver={this.onMouseOver} idName={this.props.tag}
onMouseOut={this.onMouseOut} url={httpUrl}
> width={avatarHeight}
<BaseAvatar height={avatarHeight}
name={name} />
idName={this.props.tag} {contextButton}
url={httpUrl} {badgeElement}
width={avatarHeight} </div>
height={avatarHeight} </AccessibleTooltipButton>;
/>
{ contextButton }
{ badgeElement }
</div>
</AccessibleTooltipButton>;
}, },
}); });