mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
support extra classes in static avatar
This commit is contained in:
parent
441bb4d5d7
commit
fbe255f837
@ -103,12 +103,15 @@ export class AvatarView extends BaseUpdateView {
|
|||||||
* @param {Number} size
|
* @param {Number} size
|
||||||
* @return {Element}
|
* @return {Element}
|
||||||
*/
|
*/
|
||||||
export function renderStaticAvatar(vm, size) {
|
export function renderStaticAvatar(vm, size, extraClasses = undefined) {
|
||||||
const hasAvatar = !!vm.avatarUrl;
|
const hasAvatar = !!vm.avatarUrl;
|
||||||
const avatarClasses = classNames({
|
let avatarClasses = classNames({
|
||||||
avatar: true,
|
avatar: true,
|
||||||
[`usercolor${vm.avatarColorNumber}`]: !hasAvatar,
|
[`usercolor${vm.avatarColorNumber}`]: !hasAvatar,
|
||||||
});
|
});
|
||||||
|
if (extraClasses) {
|
||||||
|
avatarClasses += ` ${extraClasses}`;
|
||||||
|
}
|
||||||
const avatarContent = hasAvatar ? renderImg(vm, size) : text(vm.avatarLetter);
|
const avatarContent = hasAvatar ? renderImg(vm, size) : text(vm.avatarLetter);
|
||||||
return tag.div({className: avatarClasses}, [avatarContent]);
|
return tag.div({className: avatarClasses}, [avatarContent]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user