Merge pull request #673 from matrix-org/dbkr/make_default_avatars_clickable
Make default avatars clickable
This commit is contained in:
commit
cd5a1abfac
1 changed files with 30 additions and 10 deletions
|
@ -145,18 +145,38 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
if (imageUrl === this.state.defaultImageUrl) {
|
if (imageUrl === this.state.defaultImageUrl) {
|
||||||
const initialLetter = this._getInitialLetter(name);
|
const initialLetter = this._getInitialLetter(name);
|
||||||
return (
|
const textNode = (
|
||||||
<span className="mx_BaseAvatar" {...otherProps}>
|
|
||||||
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
||||||
style={{ fontSize: (width * 0.65) + "px",
|
style={{ fontSize: (width * 0.65) + "px",
|
||||||
width: width + "px",
|
width: width + "px",
|
||||||
lineHeight: height + "px" }}>{initialLetter}</EmojiText>
|
lineHeight: height + "px" }}
|
||||||
|
>
|
||||||
|
{initialLetter}
|
||||||
|
</EmojiText>
|
||||||
|
);
|
||||||
|
const imgNode = (
|
||||||
<img className="mx_BaseAvatar_image" src={imageUrl}
|
<img className="mx_BaseAvatar_image" src={imageUrl}
|
||||||
alt="" title={title} onError={this.onError}
|
alt="" title={title} onError={this.onError}
|
||||||
width={width} height={height} />
|
width={width} height={height} />
|
||||||
|
);
|
||||||
|
if (onClick != null) {
|
||||||
|
return (
|
||||||
|
<AccessibleButton element='span' className="mx_BaseAvatar"
|
||||||
|
onClick={onClick} {...otherProps}
|
||||||
|
>
|
||||||
|
{textNode}
|
||||||
|
{imgNode}
|
||||||
|
</AccessibleButton>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<span className="mx_BaseAvatar" {...otherProps}>
|
||||||
|
{textNode}
|
||||||
|
{imgNode}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (onClick != null) {
|
if (onClick != null) {
|
||||||
return (
|
return (
|
||||||
<AccessibleButton className="mx_BaseAvatar mx_BaseAvatar_image"
|
<AccessibleButton className="mx_BaseAvatar mx_BaseAvatar_image"
|
||||||
|
|
Loading…
Reference in a new issue