From fbe255f8374a8e9aab0d2d9e38f08bdaf068318f Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 27 Apr 2021 15:04:01 +0200 Subject: [PATCH] support extra classes in static avatar --- src/platform/web/ui/avatar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/platform/web/ui/avatar.js b/src/platform/web/ui/avatar.js index c68d5496..4e502de9 100644 --- a/src/platform/web/ui/avatar.js +++ b/src/platform/web/ui/avatar.js @@ -103,12 +103,15 @@ export class AvatarView extends BaseUpdateView { * @param {Number} size * @return {Element} */ -export function renderStaticAvatar(vm, size) { +export function renderStaticAvatar(vm, size, extraClasses = undefined) { const hasAvatar = !!vm.avatarUrl; - const avatarClasses = classNames({ + let avatarClasses = classNames({ avatar: true, [`usercolor${vm.avatarColorNumber}`]: !hasAvatar, }); + if (extraClasses) { + avatarClasses += ` ${extraClasses}`; + } const avatarContent = hasAvatar ? renderImg(vm, size) : text(vm.avatarLetter); return tag.div({className: avatarClasses}, [avatarContent]); }