Skip to content

Commit b354573

Browse files
authored
Replace Sass variables specific to each CSS file with CSS custom properties (matrix-org#11039)
* Use CSS custom properties on _LeftPanel.pcss * Use CSS custom properties on _SpacePanel.pcss * Use CSS custom properties on _SpaceRoomView.pcss * Use CSS custom properties on _ImageView.pcss * Use CSS custom properties on _EventTile.pcss * Remove a CSS custom properties on _SpaceCreateMenu.pcss Used only on one instance * Revert "Use CSS custom properties on _ImageView.pcss" This reverts commit 0210659. * Revert "Use CSS custom properties on _EventTile.pcss" This reverts commit 83cf824. * Run prettier
1 parent d0c1a8e commit b354573

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

res/css/structures/_LeftPanel.pcss

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
$roomListCollapsedWidth: 68px;
18-
1917
.mx_MatrixChat--with-avatar {
2018
.mx_LeftPanel,
2119
.mx_LeftPanel .mx_LeftPanel_roomListContainer {
@@ -33,6 +31,11 @@ $roomListCollapsedWidth: 68px;
3331
contain: layout paint;
3432
}
3533

34+
.mx_LeftPanel_wrapper,
35+
.mx_LeftPanel {
36+
--collapsedWidth: 68px;
37+
}
38+
3639
.mx_LeftPanel_wrapper {
3740
display: flex;
3841
flex-direction: row;
@@ -46,7 +49,7 @@ $roomListCollapsedWidth: 68px;
4649
position: relative;
4750

4851
&[data-collapsed] {
49-
max-width: $roomListCollapsedWidth;
52+
max-width: var(--collapsedWidth);
5053
}
5154
}
5255
}
@@ -218,7 +221,7 @@ $roomListCollapsedWidth: 68px;
218221
width: unset !important;
219222

220223
.mx_LeftPanel_roomListContainer {
221-
width: $roomListCollapsedWidth;
224+
width: var(--collapsedWidth);
222225

223226
.mx_LeftPanel_userHeader {
224227
flex-direction: row;

res/css/structures/_SpacePanel.pcss

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
$topLevelHeight: 32px;
18-
$nestedHeight: 24px;
19-
$gutterSize: 16px;
20-
$activeBorderTransparentGap: 1px;
21-
22-
$activeBackgroundColor: $panel-actions;
23-
$activeBorderColor: $primary-content;
24-
2517
.mx_SpacePanel {
18+
--activeBackground-color: $panel-actions;
19+
--activeBorder-color: $primary-content;
20+
--activeBorder-transparent-gap: 1px;
21+
--gutterSize: 16px;
22+
--height-nested: 24px;
23+
--height-topLevel: 32px;
24+
2625
background-color: $spacePanel-bg-color;
2726
flex: 0 0 auto;
2827
padding: 0;
@@ -116,7 +115,7 @@ $activeBorderColor: $primary-content;
116115
}
117116

118117
.mx_SpaceItem:not(.hasSubSpaces) > .mx_SpaceButton {
119-
margin-left: $gutterSize;
118+
margin-left: var(--gutterSize);
120119
min-width: 40px;
121120
}
122121

@@ -130,12 +129,12 @@ $activeBorderColor: $primary-content;
130129

131130
&.mx_SpaceButton_active {
132131
&:not(.mx_SpaceButton_narrow) .mx_SpaceButton_selectionWrapper {
133-
background-color: $activeBackgroundColor;
132+
background-color: var(--activeBackground-color);
134133
}
135134

136135
&.mx_SpaceButton_narrow .mx_SpaceButton_selectionWrapper {
137-
padding: $activeBorderTransparentGap;
138-
border: 3px $activeBorderColor solid;
136+
padding: var(--activeBorder-transparent-gap);
137+
border: 3px var(--activeBorder-color) solid;
139138
}
140139
}
141140

@@ -162,9 +161,9 @@ $activeBorderColor: $primary-content;
162161
}
163162

164163
.mx_SpaceButton_toggleCollapse {
165-
width: $gutterSize;
164+
width: var(--gutterSize);
166165
padding: 10px 0;
167-
min-width: $gutterSize;
166+
min-width: var(--gutterSize);
168167
height: 20px;
169168
mask-position: center;
170169
mask-size: 20px;
@@ -174,17 +173,17 @@ $activeBorderColor: $primary-content;
174173
}
175174

176175
.mx_SpaceButton_icon {
177-
width: $topLevelHeight;
178-
min-width: $topLevelHeight;
179-
height: $topLevelHeight;
176+
width: var(--height-topLevel);
177+
min-width: var(--height-topLevel);
178+
height: var(--height-topLevel);
180179
border-radius: 8px;
181180
position: relative;
182181

183182
&::before {
184183
position: absolute;
185184
content: "";
186-
width: $topLevelHeight;
187-
height: $topLevelHeight;
185+
width: var(--height-topLevel);
186+
height: var(--height-topLevel);
188187
top: 0;
189188
left: 0;
190189
mask-position: center;
@@ -344,10 +343,10 @@ $activeBorderColor: $primary-content;
344343
padding: 0 8px 16px 0;
345344

346345
& > .mx_SpaceButton {
347-
height: $topLevelHeight;
346+
height: var(--height-topLevel);
348347

349348
&.mx_SpaceButton_active::before {
350-
height: $topLevelHeight;
349+
height: var(--height-topLevel);
351350
}
352351
}
353352

res/css/structures/_SpaceRoomView.pcss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
$SpaceRoomViewInnerWidth: 428px;
18-
1917
@define-mixin SpacePillButton {
2018
position: relative;
2119
padding: 16px 32px 16px 72px;
@@ -61,6 +59,8 @@ $SpaceRoomViewInnerWidth: 428px;
6159
}
6260

6361
.mx_SpaceRoomView {
62+
--innerWidth: 428px;
63+
6464
overflow-y: auto;
6565
flex: 1;
6666

@@ -83,11 +83,11 @@ $SpaceRoomViewInnerWidth: 428px;
8383
color: $secondary-content;
8484
margin-top: 12px;
8585
margin-bottom: 24px;
86-
max-width: $SpaceRoomViewInnerWidth;
86+
max-width: var(--innerWidth);
8787
}
8888

8989
.mx_AddExistingToSpace {
90-
max-width: $SpaceRoomViewInnerWidth;
90+
max-width: var(--innerWidth);
9191

9292
.mx_AddExistingToSpace_content {
9393
height: calc(100vh - 360px);
@@ -98,7 +98,7 @@ $SpaceRoomViewInnerWidth: 428px;
9898
.mx_SpaceRoomView_buttons {
9999
display: block;
100100
margin-top: 44px;
101-
width: $SpaceRoomViewInnerWidth;
101+
width: var(--innerWidth);
102102
text-align: right; /* button alignment right */
103103

104104
.mx_AccessibleButton_hasKind {
@@ -112,7 +112,7 @@ $SpaceRoomViewInnerWidth: 428px;
112112
}
113113

114114
.mx_Field {
115-
max-width: $SpaceRoomViewInnerWidth;
115+
max-width: var(--innerWidth);
116116

117117
& + .mx_Field {
118118
margin-top: 28px;

res/css/views/spaces/_SpaceCreateMenu.pcss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
$spacePanelWidth: 68px;
18-
1917
.mx_SpaceCreateMenu_wrapper {
2018
/* background blur everything except SpacePanel */
2119
.mx_ContextualMenu_background {
2220
background-color: $dialog-backdrop-color;
2321
opacity: 0.6;
24-
left: $spacePanelWidth;
22+
left: 68px;
2523
}
2624

2725
.mx_ContextualMenu {

0 commit comments

Comments
 (0)