Switch to rendering svg icons rather than masking them (#31550)

* Switch to rendering svg icons rather than masking them in SpacePanel

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix badly rendered icon in JoinRuleDropdown

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix badly rendered icon in RoomPreviewCard

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix badly rendered icon in Space menus

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix badly rendered icon in ThreadPanel

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update snapshots

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update screenshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove unused icon underfill

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update screenshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add test

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add missing snapshot

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-12-16 13:56:36 +00:00
committed by GitHub
parent 773662e018
commit 7e3a6d9c42
24 changed files with 645 additions and 319 deletions

View File

@@ -79,6 +79,7 @@
@import "./structures/_SearchBox.pcss";
@import "./structures/_SpaceHierarchy.pcss";
@import "./structures/_SpacePanel.pcss";
@import "./structures/_SpacePillButton.pcss";
@import "./structures/_SpaceRoomView.pcss";
@import "./structures/_SplashPage.pcss";
@import "./structures/_TabbedView.pcss";
@@ -381,7 +382,6 @@
@import "./views/spaces/_SpaceBasicSettings.pcss";
@import "./views/spaces/_SpaceChildrenPicker.pcss";
@import "./views/spaces/_SpaceCreateMenu.pcss";
@import "./views/spaces/_SpacePublicShare.pcss";
@import "./views/terms/_InlineTermsAgreement.pcss";
@import "./views/toasts/_AnalyticsToast.pcss";
@import "./views/toasts/_IncomingCallToast.pcss";

View File

@@ -44,29 +44,23 @@ Please see LICENSE files in the repository root for full details.
top: 19px; /* v-align with avatar */
right: -8px;
&::before {
content: "";
position: absolute;
width: inherit;
svg {
height: inherit;
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background-color: $background;
mask-image: url("@vector-im/compound-design-tokens/icons/chevron-down.svg");
transform: rotate(270deg);
width: inherit;
display: inline-block;
color: $background;
/* Slight alignment tweak to center the asset */
margin-left: 1px;
}
&:not(.expanded) {
opacity: 0;
&::before {
mask-position: center 1px;
}
}
&.expanded::before {
transform: rotate(90deg);
&.expanded svg {
transform: rotate(180deg);
/* Slight alignment tweak to center the asset */
margin-left: -1px;
}
}
@@ -103,7 +97,6 @@ Please see LICENSE files in the repository root for full details.
& > .mx_SpaceButton > .mx_SpaceButton_toggleCollapse {
padding: 0 10px;
margin: 0 -10px;
transform: rotate(-90deg);
}
& > .mx_SpaceTreeLevel {
@@ -166,109 +159,67 @@ Please see LICENSE files in the repository root for full details.
}
.mx_SpaceButton_toggleCollapse {
width: var(--gutterSize);
padding: 10px 0;
min-width: var(--gutterSize);
height: 20px;
mask-position: center;
mask-size: 20px;
mask-repeat: no-repeat;
background-color: $tertiary-content;
mask-image: url("@vector-im/compound-design-tokens/icons/chevron-down.svg");
width: var(--gutterSize);
flex-shrink: 0;
padding: 10px 0;
svg {
width: 20px;
height: inherit;
display: inline-block;
color: $tertiary-content;
/* Re-align with parent */
margin-left: -3px;
}
}
.mx_SpaceButton_icon {
width: var(--height-topLevel);
min-width: var(--height-topLevel);
height: var(--height-topLevel);
/* Calculate height excluding padding to allow svg to inherit */
width: calc(var(--height-topLevel) - 14px);
height: calc(var(--height-topLevel) - 14px);
flex-shrink: 0;
border-radius: 8px;
position: relative;
&::before {
position: absolute;
content: "";
width: var(--height-topLevel);
height: var(--height-topLevel);
top: 0;
left: 0;
mask-position: center;
mask-repeat: no-repeat;
mask-size: 18px;
}
}
&.mx_SpaceButton_home,
&.mx_SpaceButton_favourites,
&.mx_SpaceButton_people,
&.mx_SpaceButton_orphans,
&.mx_SpaceButton_videoRooms {
.mx_SpaceButton_icon {
background-color: $panel-actions;
&::before {
background-color: $secondary-content;
}
}
}
&.mx_SpaceButton_withIcon .mx_SpaceButton_icon {
padding: 7px;
background-color: $panel-actions;
}
&.mx_SpaceButton_home .mx_SpaceButton_icon::before {
mask-image: url("@vector-im/compound-design-tokens/icons/home-solid.svg");
}
&.mx_SpaceButton_favourites .mx_SpaceButton_icon::before {
mask-image: url("@vector-im/compound-design-tokens/icons/favourite-solid.svg");
}
&.mx_SpaceButton_people .mx_SpaceButton_icon::before {
mask-image: url("@vector-im/compound-design-tokens/icons/user-profile-solid.svg");
}
&.mx_SpaceButton_orphans .mx_SpaceButton_icon::before {
mask-image: url("@vector-im/compound-design-tokens/icons/room.svg");
}
&.mx_SpaceButton_videoRooms .mx_SpaceButton_icon::before {
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-solid.svg");
svg {
width: inherit;
height: inherit;
display: block;
color: $secondary-content;
}
}
&.mx_SpaceButton_new .mx_SpaceButton_icon {
&::before {
background-color: $primary-content;
mask-image: url("@vector-im/compound-design-tokens/icons/plus.svg");
background-color: unset;
svg {
color: $primary-content;
transition: all 0.2s ease-in-out; /* TODO transition */
}
}
&.mx_SpaceButton_newCancel .mx_SpaceButton_icon::before {
&.mx_SpaceButton_newCancel .mx_SpaceButton_icon svg {
transform: rotate(45deg);
}
.mx_SpaceButton_menuButton {
width: 20px;
min-width: 20px; /* yay flex */
height: 20px;
width: 16px;
height: 16px;
padding: var(--cpd-space-0-5x);
flex-shrink: 0;
margin-top: auto;
margin-bottom: auto;
display: none;
position: absolute;
right: 4px;
&::before {
top: 3px;
left: 2px;
content: "";
width: 16px;
height: 16px;
position: absolute;
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
mask-image: url("@vector-im/compound-design-tokens/icons/overflow-horizontal.svg");
background: $primary-content;
svg {
width: inherit;
height: inherit;
display: block;
color: $primary-content;
}
}
}
@@ -341,18 +292,6 @@ Please see LICENSE files in the repository root for full details.
padding: 0 0 16px 0;
scrollbar-gutter: stable;
& > .mx_SpaceButton {
height: var(--height-topLevel);
&.mx_SpaceButton_active::before {
height: var(--height-topLevel);
}
}
& > ul {
padding-left: 0;
}
&.mx_IndicatorScrollbar_topOverflow {
mask-image: linear-gradient(to bottom, transparent, black 16px);
}

View File

@@ -0,0 +1,48 @@
/*
Copyright 2025 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
.mx_SpacePillButton {
position: relative;
padding: 16px 32px 16px 72px;
width: 432px;
box-sizing: border-box;
border-radius: 8px;
border: 1px solid $input-border-color;
font-size: $font-17px;
font-weight: var(--cpd-font-weight-semibold);
margin: 20px 0;
> div {
margin-top: 4px;
font-weight: normal;
font-size: $font-15px;
color: $secondary-content;
}
svg {
position: absolute;
content: "";
width: 28px;
height: 28px;
top: 50%;
transform: translateY(-50%);
left: 22px;
color: $tertiary-content;
}
&:hover {
border-color: var(--cpd-color-bg-action-primary-rest);
svg {
color: var(--cpd-color-icon-primary);
}
> span {
color: $primary-content;
}
}
}

View File

@@ -6,51 +6,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
@define-mixin SpacePillButton {
position: relative;
padding: 16px 32px 16px 72px;
width: 432px;
box-sizing: border-box;
border-radius: 8px;
border: 1px solid $input-border-color;
font-size: $font-17px;
font-weight: var(--cpd-font-weight-semibold);
margin: 20px 0;
> div {
margin-top: 4px;
font-weight: normal;
font-size: $font-15px;
color: $secondary-content;
}
&::before {
position: absolute;
content: "";
width: 28px;
height: 28px;
top: 50%;
transform: translateY(-50%);
left: 22px;
mask-position: center;
mask-repeat: no-repeat;
mask-size: 28px;
background-color: $tertiary-content;
}
&:hover {
border-color: var(--cpd-color-bg-action-primary-rest);
&::before {
background-color: var(--cpd-color-icon-primary);
}
> span {
color: $primary-content;
}
}
}
.mx_SpaceRoomView {
--innerWidth: 428px;
@@ -242,20 +197,6 @@ Please see LICENSE files in the repository root for full details.
}
}
.mx_SpaceRoomView_privateScope {
> .mx_AccessibleButton {
@mixin SpacePillButton;
}
.mx_SpaceRoomView_privateScope_justMeButton::before {
mask-image: url("@vector-im/compound-design-tokens/icons/user-profile-solid.svg");
}
.mx_SpaceRoomView_privateScope_meAndMyTeammatesButton::before {
mask-image: url("@vector-im/compound-design-tokens/icons/group.svg");
}
}
.mx_SpaceRoomView_inviteTeammates {
.mx_SpaceRoomView_inviteTeammates_buttons {
color: $secondary-content;

View File

@@ -47,16 +47,12 @@ Please see LICENSE files in the repository root for full details.
background: $quinary-content;
}
&::before {
svg {
margin-left: 2px;
content: "";
width: 20px;
height: 20px;
background: currentColor;
mask-image: url("@vector-im/compound-design-tokens/icons/chevron-down.svg");
mask-size: 100%;
mask-repeat: no-repeat;
float: right;
width: 20px;
display: inline-block;
vertical-align: bottom;
}
}
}
@@ -181,25 +177,24 @@ Please see LICENSE files in the repository root for full details.
}
&[aria-checked="true"] {
:first-child {
span:first-child {
margin-left: -20px;
}
:first-child::before {
content: "";
svg {
width: 12px;
height: 12px;
margin-right: 8px;
mask-image: url("@vector-im/compound-design-tokens/icons/check.svg");
mask-size: 100%;
mask-repeat: no-repeat;
background-color: $primary-content;
color: $primary-content;
display: inline-block;
vertical-align: middle;
position: absolute;
top: 14px;
left: 10px;
}
}
:last-child {
span:last-child {
color: $secondary-content;
}
}

View File

@@ -833,7 +833,6 @@ $left-gutter: 64px;
background-repeat: no-repeat;
background-size: contain;
&::before,
&::after {
content: "";
display: block;
@@ -844,10 +843,6 @@ $left-gutter: 64px;
mask-size: contain;
}
&::before {
mask-size: 80%;
}
&.mx_EventTile_e2eIcon_warning::after {
mask-image: url("@vector-im/compound-design-tokens/icons/error-solid.svg");
background-color: $e2e-warning-color; /* red */

View File

@@ -22,20 +22,13 @@ Please see LICENSE files in the repository root for full details.
line-height: $font-24px;
color: $primary-content;
margin-top: $spacing-24;
position: relative;
padding-left: calc(20px + $spacing-8);
&::before {
content: "";
position: absolute;
height: $font-24px;
width: 20px;
left: 0;
mask-repeat: no-repeat;
mask-position: center;
mask-size: contain;
mask-image: url("@vector-im/compound-design-tokens/icons/info-solid.svg");
background-color: $secondary-content;
svg {
height: 1em;
width: 1em;
margin-right: $spacing-8;
color: $secondary-content;
vertical-align: -2px;
}
}
@@ -63,25 +56,19 @@ Please see LICENSE files in the repository root for full details.
align-items: center;
.mx_RoomPreviewCard_video {
width: 50px;
height: 50px;
width: 22px;
height: 22px;
padding: 14px;
border-radius: calc((50px + 2 * 3px) / 2);
background-color: $accent;
border: 3px solid $system;
position: relative;
left: calc(-50px / 4 - 3px);
&::before {
content: "";
background-color: $button-primary-fg-color;
position: absolute;
width: 50px;
height: 50px;
mask-size: 22px;
mask-position: center;
mask-repeat: no-repeat;
mask-image: url("@vector-im/compound-design-tokens/icons/video-call-solid.svg");
svg {
width: inherit;
height: inherit;
color: $button-primary-fg-color;
}
}

View File

@@ -34,18 +34,6 @@ Please see LICENSE files in the repository root for full details.
}
}
.mx_SpaceCreateMenuType {
@mixin SpacePillButton;
}
.mx_SpaceCreateMenuType_public::before {
mask-image: url("@vector-im/compound-design-tokens/icons/public.svg");
}
.mx_SpaceCreateMenuType_private::before {
mask-image: url("@vector-im/compound-design-tokens/icons/lock-solid.svg");
}
.mx_SpaceCreateMenu_back {
width: 28px;
height: 28px;

View File

@@ -1,21 +0,0 @@
/*
Copyright 2024 New Vector Ltd.
Copyright 2021 The Matrix.org Foundation C.I.C.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
.mx_SpacePublicShare {
.mx_AccessibleButton {
@mixin SpacePillButton;
&.mx_SpacePublicShare_shareButton::before {
mask-image: url("@vector-im/compound-design-tokens/icons/link.svg");
}
&.mx_SpacePublicShare_inviteButton::before {
mask-image: url("$(res)/img/element-icons/room/invite.svg");
}
}
}