Skip to content

Commit 6ae11da

Browse files
authored
New room list: fix spacing and padding (#29607)
* fix(menu): reduce gap between button and button size * fix(notification decoration): increase gap between icons * fix(room list item): different right padding depending on the menu, notification decoration and the regular case * test: update snapshots * test(e2e): update snapshots
1 parent fac9828 commit 6ae11da

16 files changed

+49
-25
lines changed

res/css/views/rooms/RoomListPanel/_RoomListItemView.pcss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
&:hover {
2121
background-color: var(--cpd-color-bg-action-secondary-hovered);
22+
23+
.mx_RoomListItemView_content {
24+
padding-right: var(--cpd-space-1-5x);
25+
}
2226
}
2327

2428
.mx_RoomListItemView_container {
@@ -27,7 +31,6 @@
2731
height: 100%;
2832

2933
.mx_RoomListItemView_content {
30-
padding-right: var(--cpd-space-3x);
3134
height: 100%;
3235
flex: 1;
3336
/* The border is only under the room name and the future hover menu */
@@ -46,8 +49,24 @@
4649

4750
.mx_RoomListItemView_menu_open {
4851
background-color: var(--cpd-color-bg-action-secondary-hovered);
52+
53+
.mx_RoomListItemView_content {
54+
padding-right: var(--cpd-space-1-5x);
55+
}
4956
}
5057

5158
.mx_RoomListItemView_selected {
5259
background-color: var(--cpd-color-bg-action-secondary-pressed);
5360
}
61+
62+
.mx_RoomListItemView_notification_decoration {
63+
.mx_RoomListItemView_content {
64+
padding-right: var(--cpd-space-2x);
65+
}
66+
}
67+
68+
.mx_RoomListItemView_empty {
69+
.mx_RoomListItemView_content {
70+
padding-right: var(--cpd-space-3x);
71+
}
72+
}

src/components/views/rooms/NotificationDecoration.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function NotificationDecoration({
4444
<Flex
4545
align="center"
4646
justify="center"
47-
gap="var(--cpd-space-1x)"
47+
gap="var(--cpd-space-1-5x)"
4848
{...props}
4949
data-testid="notification-decoration"
5050
>

src/components/views/rooms/RoomListPanel/RoomListItemMenuView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function RoomListItemMenuView({ room, setMenuOpen }: RoomListItemMenuView
4343
const vm = useRoomListItemMenuViewModel(room);
4444

4545
return (
46-
<Flex className="mx_RoomListItemMenuView" align="center" gap="var(--cpd-space-1x)">
46+
<Flex className="mx_RoomListItemMenuView" align="center" gap="var(--cpd-space-0-5x)">
4747
{vm.showMoreOptionsMenu && <MoreOptionsMenu setMenuOpen={setMenuOpen} vm={vm} />}
4848
</Flex>
4949
);
@@ -77,7 +77,7 @@ function MoreOptionsMenu({ vm, setMenuOpen }: MoreOptionsMenuProps): JSX.Element
7777
title={_t("room_list|room|more_options")}
7878
showTitle={false}
7979
align="start"
80-
trigger={<MoreOptionsButton />}
80+
trigger={<MoreOptionsButton size="24px" />}
8181
>
8282
{vm.canMarkAsRead && (
8383
<MenuItem

src/components/views/rooms/RoomListPanel/RoomListItemView.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ export function RoomListItemView({ room, isSelected, ...props }: RoomListItemVie
3838
// Using display: none; and then display:flex when hovered in CSS causes the menu to be misaligned
3939
const showHoverDecoration = (isMenuOpen || isHover) && vm.showHoverMenu;
4040

41+
const isNotificationDecorationVisible =
42+
!showHoverDecoration && (vm.notificationState.hasAnyNotificationOrActivity || vm.notificationState.muted);
43+
4144
return (
4245
<button
4346
className={classNames("mx_RoomListItemView", {
47+
mx_RoomListItemView_empty: !isNotificationDecorationVisible && !showHoverDecoration,
48+
mx_RoomListItemView_notification_decoration: isNotificationDecorationVisible,
4449
mx_RoomListItemView_menu_open: showHoverDecoration,
4550
mx_RoomListItemView_selected: isSelected,
4651
})}

test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomList-test.tsx.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ exports[`<RoomList /> should render a room list 1`] = `
2525
<button
2626
aria-label="Open room room0"
2727
aria-selected="false"
28-
class="mx_RoomListItemView"
28+
class="mx_RoomListItemView mx_RoomListItemView_empty"
2929
role="gridcell"
3030
style="height: 48px; left: 0px; position: absolute; top: 0px; width: 100%;"
3131
type="button"
@@ -72,7 +72,7 @@ exports[`<RoomList /> should render a room list 1`] = `
7272
<button
7373
aria-label="Open room room1"
7474
aria-selected="false"
75-
class="mx_RoomListItemView"
75+
class="mx_RoomListItemView mx_RoomListItemView_empty"
7676
role="gridcell"
7777
style="height: 48px; left: 0px; position: absolute; top: 48px; width: 100%;"
7878
type="button"
@@ -119,7 +119,7 @@ exports[`<RoomList /> should render a room list 1`] = `
119119
<button
120120
aria-label="Open room room2"
121121
aria-selected="false"
122-
class="mx_RoomListItemView"
122+
class="mx_RoomListItemView mx_RoomListItemView_empty"
123123
role="gridcell"
124124
style="height: 48px; left: 0px; position: absolute; top: 96px; width: 100%;"
125125
type="button"
@@ -166,7 +166,7 @@ exports[`<RoomList /> should render a room list 1`] = `
166166
<button
167167
aria-label="Open room room3"
168168
aria-selected="false"
169-
class="mx_RoomListItemView"
169+
class="mx_RoomListItemView mx_RoomListItemView_empty"
170170
role="gridcell"
171171
style="height: 48px; left: 0px; position: absolute; top: 144px; width: 100%;"
172172
type="button"
@@ -213,7 +213,7 @@ exports[`<RoomList /> should render a room list 1`] = `
213213
<button
214214
aria-label="Open room room4"
215215
aria-selected="false"
216-
class="mx_RoomListItemView"
216+
class="mx_RoomListItemView mx_RoomListItemView_empty"
217217
role="gridcell"
218218
style="height: 48px; left: 0px; position: absolute; top: 192px; width: 100%;"
219219
type="button"
@@ -260,7 +260,7 @@ exports[`<RoomList /> should render a room list 1`] = `
260260
<button
261261
aria-label="Open room room5"
262262
aria-selected="false"
263-
class="mx_RoomListItemView"
263+
class="mx_RoomListItemView mx_RoomListItemView_empty"
264264
role="gridcell"
265265
style="height: 48px; left: 0px; position: absolute; top: 240px; width: 100%;"
266266
type="button"
@@ -307,7 +307,7 @@ exports[`<RoomList /> should render a room list 1`] = `
307307
<button
308308
aria-label="Open room room6"
309309
aria-selected="false"
310-
class="mx_RoomListItemView"
310+
class="mx_RoomListItemView mx_RoomListItemView_empty"
311311
role="gridcell"
312312
style="height: 48px; left: 0px; position: absolute; top: 288px; width: 100%;"
313313
type="button"
@@ -354,7 +354,7 @@ exports[`<RoomList /> should render a room list 1`] = `
354354
<button
355355
aria-label="Open room room7"
356356
aria-selected="false"
357-
class="mx_RoomListItemView"
357+
class="mx_RoomListItemView mx_RoomListItemView_empty"
358358
role="gridcell"
359359
style="height: 48px; left: 0px; position: absolute; top: 336px; width: 100%;"
360360
type="button"
@@ -401,7 +401,7 @@ exports[`<RoomList /> should render a room list 1`] = `
401401
<button
402402
aria-label="Open room room8"
403403
aria-selected="false"
404-
class="mx_RoomListItemView"
404+
class="mx_RoomListItemView mx_RoomListItemView_empty"
405405
role="gridcell"
406406
style="height: 48px; left: 0px; position: absolute; top: 384px; width: 100%;"
407407
type="button"
@@ -448,7 +448,7 @@ exports[`<RoomList /> should render a room list 1`] = `
448448
<button
449449
aria-label="Open room room9"
450450
aria-selected="false"
451-
class="mx_RoomListItemView"
451+
class="mx_RoomListItemView mx_RoomListItemView_empty"
452452
role="gridcell"
453453
style="height: 48px; left: 0px; position: absolute; top: 432px; width: 100%;"
454454
type="button"

test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomListItemMenuView-test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exports[`<RoomListItemMenuView /> should render the more options menu 1`] = `
44
<DocumentFragment>
55
<div
66
class="mx_Flex mx_RoomListItemMenuView"
7-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
7+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: start; --mx-flex-gap: var(--cpd-space-0-5x); --mx-flex-wrap: nowrap;"
88
>
99
<button
1010
aria-disabled="false"
@@ -16,7 +16,7 @@ exports[`<RoomListItemMenuView /> should render the more options menu 1`] = `
1616
data-state="closed"
1717
id="radix-:r0:"
1818
role="button"
19-
style="--cpd-icon-button-size: 32px;"
19+
style="--cpd-icon-button-size: 24px;"
2020
tabindex="0"
2121
type="button"
2222
>

test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/RoomListItemView-test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`<RoomListItemView /> should be selected if isSelected=true 1`] = `
55
<button
66
aria-label="Open room room1"
77
aria-selected="true"
8-
class="mx_RoomListItemView mx_RoomListItemView_selected"
8+
class="mx_RoomListItemView mx_RoomListItemView_empty mx_RoomListItemView_selected"
99
type="button"
1010
>
1111
<div
@@ -55,7 +55,7 @@ exports[`<RoomListItemView /> should render a room item 1`] = `
5555
<button
5656
aria-label="Open room room1"
5757
aria-selected="false"
58-
class="mx_RoomListItemView"
58+
class="mx_RoomListItemView mx_RoomListItemView_empty"
5959
type="button"
6060
>
6161
<div

test/unit-tests/components/views/rooms/__snapshots__/NotificationDecoration-test.tsx.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`<NotificationDecoration /> should render the activity decoration 1`] =
55
<div
66
class="mx_Flex"
77
data-testid="notification-decoration"
8-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
8+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
99
>
1010
<div
1111
class="_unread_1k06b_8"
@@ -21,7 +21,7 @@ exports[`<NotificationDecoration /> should render the invitation decoration 1`]
2121
<div
2222
class="mx_Flex"
2323
data-testid="notification-decoration"
24-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
24+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
2525
>
2626
<span
2727
class="_unread-counter_1ibqq_8"
@@ -37,7 +37,7 @@ exports[`<NotificationDecoration /> should render the mention decoration 1`] = `
3737
<div
3838
class="mx_Flex"
3939
data-testid="notification-decoration"
40-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
40+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
4141
>
4242
<svg
4343
fill="var(--cpd-color-icon-accent-primary)"
@@ -64,7 +64,7 @@ exports[`<NotificationDecoration /> should render the muted decoration 1`] = `
6464
<div
6565
class="mx_Flex"
6666
data-testid="notification-decoration"
67-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
67+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
6868
>
6969
<svg
7070
fill="var(--cpd-color-icon-tertiary)"
@@ -89,7 +89,7 @@ exports[`<NotificationDecoration /> should render the notification decoration 1`
8989
<div
9090
class="mx_Flex"
9191
data-testid="notification-decoration"
92-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
92+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
9393
>
9494
<span
9595
class="_unread-counter_1ibqq_8"
@@ -105,7 +105,7 @@ exports[`<NotificationDecoration /> should render the notification decoration wi
105105
<div
106106
class="mx_Flex"
107107
data-testid="notification-decoration"
108-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
108+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
109109
>
110110
<div
111111
class="_unread-counter_1ibqq_8"
@@ -119,7 +119,7 @@ exports[`<NotificationDecoration /> should render the unset message decoration 1
119119
<div
120120
class="mx_Flex"
121121
data-testid="notification-decoration"
122-
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1x); --mx-flex-wrap: nowrap;"
122+
style="--mx-flex-display: flex; --mx-flex-direction: row; --mx-flex-align: center; --mx-flex-justify: center; --mx-flex-gap: var(--cpd-space-1-5x); --mx-flex-wrap: nowrap;"
123123
>
124124
<svg
125125
fill="var(--cpd-color-icon-critical-primary)"

0 commit comments

Comments
 (0)