Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5944392

Browse files
author
Kerry
authored
Replace mask-images with svg components in MessageActionBar (#9088)
* Use svg components in messageactionbar * highlight options button in pinned messages mock buttons
1 parent bc30713 commit 5944392

File tree

21 files changed

+119
-123
lines changed

21 files changed

+119
-123
lines changed

res/css/structures/_MatrixChat.pcss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ limitations under the License.
8686
// (IF there is NO margin on the leftPanel_wrapper)
8787
// The resizeHandle does not change the gap between the left panel and the room view:
8888
// the resizeHandle width is:
89-
// 11px = 10px (padding) + 1px (width) and the total negative margin is -12px -> the handle requires no space
89+
// 11px = 10px (padding) + 1px (width)
90+
// and the total negative margin is -12px ->
91+
// the handle requires no space
9092
// right: -6px left: -6px positions the element exactly on the edge of leftPanel.
9193
// left+=1 and right-=1 => resizeHandle moves 1px to the right closer to the center of the gap.
9294
// We want the handle to be in the middle of the gap so it is shifted by ($container-gap-width / 2)

res/css/views/messages/_MessageActionBar.pcss

Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -89,103 +89,55 @@ limitations under the License.
8989
}
9090
}
9191

92-
.mx_MessageActionBar_maskButton {
92+
.mx_MessageActionBar_iconButton {
93+
--MessageActionBar-icon-size: 18px;
9394
width: var(--MessageActionBar-size-button);
9495
height: var(--MessageActionBar-size-button);
96+
color: $secondary-content;
97+
display: flex;
98+
align-items: center;
99+
justify-content: center;
100+
101+
svg {
102+
height: var(--MessageActionBar-icon-size);
103+
width: var(--MessageActionBar-icon-size);
104+
flex: 0 0 var(--MessageActionBar-icon-size);
105+
}
95106

96107
&:disabled,
97108
&[disabled] {
98109
cursor: not-allowed;
99110
opacity: .75;
100111
}
101112

102-
&::after {
103-
content: '';
104-
position: absolute;
105-
top: 0;
106-
left: 0;
107-
height: 100%;
108-
width: 100%;
109-
mask-size: 18px;
110-
mask-repeat: no-repeat;
111-
mask-position: center;
112-
background-color: $secondary-content;
113-
}
114-
115-
&:hover::after {
116-
background-color: $primary-content;
117-
}
118-
119-
&.mx_MessageActionBar_reactButton::after {
120-
mask-image: url('$(res)/img/element-icons/room/message-bar/emoji.svg');
121-
}
122-
123-
&.mx_MessageActionBar_replyButton::after {
124-
mask-image: url('$(res)/img/element-icons/room/message-bar/reply.svg');
113+
&:hover {
114+
color: $primary-content;
125115
}
126116

127117
&.mx_MessageActionBar_threadButton {
128-
&::after {
129-
mask-image: url('$(res)/img/element-icons/message/thread.svg');
130-
}
131118

132119
.mx_Indicator {
133120
background: $links;
134121
animation-iteration-count: infinite;
135122
}
136123
}
137124

138-
&.mx_MessageActionBar_favouriteButton::after {
139-
mask-image: url('$(res)/img/element-icons/room/message-bar/star.svg');
140-
}
141-
142-
&.mx_MessageActionBar_favouriteButton_fillstar::after {
143-
background-color: var(--MessageActionBar-star-button-color);
144-
}
145-
146-
&.mx_MessageActionBar_editButton::after {
147-
mask-image: url('$(res)/img/element-icons/room/message-bar/edit.svg');
148-
}
149-
150-
&.mx_MessageActionBar_optionsButton::after {
151-
mask-image: url('$(res)/img/element-icons/context-menu.svg');
152-
}
153-
154-
&.mx_MessageActionBar_resendButton::after {
155-
mask-image: url('$(res)/img/element-icons/retry.svg');
156-
}
157-
158-
&.mx_MessageActionBar_cancelButton::after {
159-
mask-image: url('$(res)/img/element-icons/trashcan.svg');
125+
&.mx_MessageActionBar_favouriteButton_fillstar {
126+
color: var(--MessageActionBar-star-button-color);
160127
}
161128

162129
&.mx_MessageActionBar_downloadButton {
163-
&::after {
164-
mask-size: 14px;
165-
mask-image: url('$(res)/img/download.svg');
166-
}
130+
--MessageActionBar-icon-size: 14px;
167131

168-
&.mx_MessageActionBar_downloadSpinnerButton::after {
169-
background-color: transparent; // hide the download icon mask
132+
&.mx_MessageActionBar_downloadSpinnerButton {
133+
svg {
134+
display: none; // hide the download icon
135+
}
170136
}
171137
}
172138

173-
&.mx_MessageActionBar_expandMessageButton::after {
174-
mask-size: 12px;
175-
mask-image: url('$(res)/img/element-icons/expand-message.svg');
176-
}
177-
178-
&.mx_MessageActionBar_collapseMessageButton::after {
179-
mask-size: 12px;
180-
mask-image: url('$(res)/img/element-icons/collapse-message.svg');
181-
}
182-
183-
&.mx_MessageActionBar_viewInRoomButton::after {
184-
mask-image: url('$(res)/img/element-icons/view-in-room.svg');
185-
}
186-
187-
&.mx_MessageActionBar_copyLinkButton::after {
188-
mask-image: url('$(res)/img/element-icons/link.svg');
139+
&.mx_MessageActionBar_expandCollapseMessageButton {
140+
--MessageActionBar-icon-size: 12px;
189141
}
190142
}
191143
}

res/css/views/right_panel/_PinnedMessagesCard.pcss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ limitations under the License.
4242
background: var(--MessageActionBar-item-hover-background);
4343
border-radius: var(--MessageActionBar-item-hover-borderRadius);
4444
z-index: var(--MessageActionBar-item-hover-zIndex);
45-
46-
&::after {
47-
background-color: $primary-content;
48-
}
45+
color: $primary-content;
4946
}
5047
}
5148

res/css/views/rooms/_RoomSublist.pcss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ limitations under the License.
213213
}
214214

215215
&.mx_RoomSublist_resizeBox_forceExpanded .mx_RoomSublist_tiles {
216-
// in this state the div can collapse its height entirely in Chromium, so prevent that by allowing overflow
216+
// in this state the div can collapse its height entirely in Chromium,
217+
// so prevent that by allowing overflow
217218
overflow: visible;
218219
// clear the min-height to make it not collapse entirely in a state with no active resizer
219220
min-height: unset;

res/img/download.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 3 additions & 3 deletions
Loading
Lines changed: 1 addition & 1 deletion
Loading

res/img/element-icons/link.svg

Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)