You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-04 23:02:14 +03:00
Don't c+p the complex markup
This commit is contained in:
@@ -145,30 +145,30 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
if (imageUrl === this.state.defaultImageUrl) {
|
if (imageUrl === this.state.defaultImageUrl) {
|
||||||
const initialLetter = this._getInitialLetter(name);
|
const initialLetter = this._getInitialLetter(name);
|
||||||
|
const textNode = <EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
||||||
|
style={{ fontSize: (width * 0.65) + "px",
|
||||||
|
width: width + "px",
|
||||||
|
lineHeight: height + "px" }}
|
||||||
|
>
|
||||||
|
{initialLetter}
|
||||||
|
</EmojiText>;
|
||||||
|
const imgNode = <img className="mx_BaseAvatar_image" src={imageUrl}
|
||||||
|
alt="" title={title} onError={this.onError}
|
||||||
|
width={width} height={height} />;
|
||||||
if (onClick != null) {
|
if (onClick != null) {
|
||||||
return (
|
return (
|
||||||
<AccessibleButton element='span' className="mx_BaseAvatar"
|
<AccessibleButton element='span' className="mx_BaseAvatar"
|
||||||
onClick={onClick} {...otherProps}
|
onClick={onClick} {...otherProps}
|
||||||
>
|
>
|
||||||
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
{textNode}
|
||||||
style={{ fontSize: (width * 0.65) + "px",
|
{imgNode}
|
||||||
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>
|
</AccessibleButton>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<span className="mx_BaseAvatar" {...otherProps}>
|
<span className="mx_BaseAvatar" {...otherProps}>
|
||||||
<EmojiText className="mx_BaseAvatar_initial" aria-hidden="true"
|
{textNode}
|
||||||
style={{ fontSize: (width * 0.65) + "px",
|
{imgNode}
|
||||||
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} />
|
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user