You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-11 20:22:36 +03:00
Make default avatars clickable
BaseAvatar can be passed an onClick which is called when it's, er, clicked, except when it was the default avatar in which case it merrily ignored it. Make it not ignore it.
This commit is contained in:
@@ -145,6 +145,21 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
if (imageUrl === this.state.defaultImageUrl) {
|
if (imageUrl === this.state.defaultImageUrl) {
|
||||||
const initialLetter = this._getInitialLetter(name);
|
const initialLetter = this._getInitialLetter(name);
|
||||||
|
if (onClick != null) {
|
||||||
|
return (
|
||||||
|
<AccessibleButton element='span' className="mx_BaseAvatar"
|
||||||
|
onClick={onClick} {...otherProps}
|
||||||
|
>
|
||||||
|
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
||||||
|
style={{ fontSize: (width * 0.65) + "px",
|
||||||
|
width: width + "px",
|
||||||
|
lineHeight: height + "px" }}>{initialLetter}</EmojiText>
|
||||||
|
<img className="mx_BaseAvatar_image" src={imageUrl}
|
||||||
|
alt="" title={title} onError={this.onError}
|
||||||
|
width={width} height={height} />
|
||||||
|
</AccessibleButton>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
return (
|
return (
|
||||||
<span className="mx_BaseAvatar" {...otherProps}>
|
<span className="mx_BaseAvatar" {...otherProps}>
|
||||||
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
||||||
@@ -157,6 +172,7 @@ module.exports = React.createClass({
|
|||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (onClick != null) {
|
if (onClick != null) {
|
||||||
return (
|
return (
|
||||||
<AccessibleButton className="mx_BaseAvatar mx_BaseAvatar_image"
|
<AccessibleButton className="mx_BaseAvatar mx_BaseAvatar_image"
|
||||||
|
|||||||
Reference in New Issue
Block a user