work around --avatar-size being compiled away in build

This commit is contained in:
Bruno Windels 2021-04-28 13:45:43 +02:00
parent bfaeffcb51
commit b35b6ec496
4 changed files with 34 additions and 21 deletions

View File

@ -107,6 +107,7 @@ export function renderStaticAvatar(vm, size, extraClasses = undefined) {
const hasAvatar = !!vm.avatarUrl; const hasAvatar = !!vm.avatarUrl;
let avatarClasses = classNames({ let avatarClasses = classNames({
avatar: true, avatar: true,
[`size-${size}`]: true,
[`usercolor${vm.avatarColorNumber}`]: !hasAvatar, [`usercolor${vm.avatarColorNumber}`]: !hasAvatar,
}); });
if (extraClasses) { if (extraClasses) {

View File

@ -15,23 +15,48 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
.avatar { .hydrogen {
--avatar-size: 32px;
}
.hydrogen .avatar {
width: var(--avatar-size); width: var(--avatar-size);
height: var(--avatar-size); height: var(--avatar-size);
line-height: var(--avatar-size);
font-size: calc(var(--avatar-size) * 0.6);
overflow: hidden; overflow: hidden;
flex-shrink: 0; flex-shrink: 0;
user-select: none; user-select: none;
line-height: var(--avatar-size);
font-size: calc(var(--avatar-size) * 0.6);
text-align: center; text-align: center;
speak: none; speak: none;
} }
.avatar.large { .hydrogen .avatar img {
--avatar-size: 40px;
}
.avatar img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
/* work around postcss-css-variables limitations and repeat variable usage */
.hydrogen .avatar.size-128 {
--avatar-size: 128px;
width: var(--avatar-size);
height: var(--avatar-size);
line-height: var(--avatar-size);
font-size: calc(var(--avatar-size) * 0.6);
}
.hydrogen .avatar.size-64 {
--avatar-size: 64px;
width: var(--avatar-size);
height: var(--avatar-size);
line-height: var(--avatar-size);
font-size: calc(var(--avatar-size) * 0.6);
}
.hydrogen .avatar.size-24 {
--avatar-size: 24px;
width: var(--avatar-size);
height: var(--avatar-size);
line-height: var(--avatar-size);
font-size: calc(var(--avatar-size) * 0.6);
}

View File

@ -19,7 +19,6 @@ limitations under the License.
.SessionPickerView { .SessionPickerView {
padding: 0.4em; padding: 0.4em;
--avatar-size: 32px;
} }
.SessionPickerView ul { .SessionPickerView ul {

View File

@ -255,7 +255,6 @@ a.button-action {
/* make scrollbar hit right edge of parent */ /* make scrollbar hit right edge of parent */
padding-right: 8px; padding-right: 8px;
margin-right: -8px; margin-right: -8px;
--avatar-size: 32px;
} }
.RoomList > li { .RoomList > li {
@ -440,10 +439,6 @@ a {
background-position-x: 10px; background-position-x: 10px;
} }
.RoomHeader {
--avatar-size: 32px;
}
.RoomHeader .topic { .RoomHeader .topic {
font-size: 14rem; font-size: 14rem;
} }
@ -533,10 +528,6 @@ ul.Timeline > li.messageStatus .message-container > p {
align-items: center; align-items: center;
} }
.message-container .avatar {
--avatar-size: 25px;
}
.TextMessageView { .TextMessageView {
width: 100%; width: 100%;
} }
@ -879,12 +870,10 @@ button.link {
.InviteView_roomAvatar { .InviteView_roomAvatar {
grid-area: avatar; grid-area: avatar;
--avatar-size: 64px;
} }
.InviteView_dmAvatar { .InviteView_dmAvatar {
align-self: center; align-self: center;
--avatar-size: 128px;
} }
.InviteView_inviter { .InviteView_inviter {
@ -893,7 +882,6 @@ button.link {
} }
.InviteView_inviter .avatar { .InviteView_inviter .avatar {
--avatar-size: 24px;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-right: 4px; margin-right: 4px;