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

Commit 4fbff9f

Browse files
authored
Update design of files list in right panel (#144)
* Update design of files list in right panel Signed-off-by: Michael Telatynski <[email protected]> * Make i18n script happier Signed-off-by: Michael Telatynski <[email protected]> * Improve coverage Signed-off-by: Michael Telatynski <[email protected]> * Improve coverage Signed-off-by: Michael Telatynski <[email protected]> * Improve coverage Signed-off-by: Michael Telatynski <[email protected]> * Discard changes to src/components/structures/MessagePanel.tsx * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Iterate Signed-off-by: Michael Telatynski <[email protected]> * Update tests Signed-off-by: Michael Telatynski <[email protected]> * Fix flaky screenshot test Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent d770e2a commit 4fbff9f

20 files changed

+276
-107
lines changed

playwright/e2e/right-panel/file-panel.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ test.describe("FilePanel", () => {
8484
await expect(filePanelMessageList.locator(".mx_EventTile")).toHaveCount(3);
8585

8686
// Assert that the download links are rendered
87-
await expect(filePanelMessageList.locator(".mx_MFileBody_download")).toHaveCount(3);
87+
await expect(filePanelMessageList.locator(".mx_MFileBody_download,.mx_MFileBody_info")).toHaveCount(3);
8888

8989
// Assert that the sender of the files is rendered on all of the tiles
9090
await expect(filePanelMessageList.getByText(NAME)).toHaveCount(3);
@@ -176,8 +176,7 @@ test.describe("FilePanel", () => {
176176
// Assert that the file size is displayed in kibibytes, not kilobytes (1000 bytes)
177177
// See: https://github.com/vector-im/element-web/issues/24866
178178
await expect(tile.locator(".mx_MFileBody_info_filename", { hasText: size })).toBeVisible();
179-
await expect(tile.locator(".mx_MFileBody_download a", { hasText: size })).toBeVisible();
180-
await expect(tile.locator(".mx_MFileBody_download .mx_MImageBody_size", { hasText: size })).toBeVisible();
179+
await expect(tile.locator(".mx_MFileBody_info", { hasText: size })).toBeVisible();
181180
});
182181
});
183182

20 Bytes
Loading
62 Bytes
Loading
89 Bytes
Loading
99 Bytes
Loading
-2 Bytes
Loading
-9 Bytes
Loading
-3.22 KB
Loading

res/css/structures/_FilePanel.pcss

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,70 +20,51 @@ Please see LICENSE files in the repository root for full details.
2020

2121
.mx_RoomView_MessageList {
2222
width: 100%;
23-
24-
h2 {
25-
display: none;
26-
}
23+
gap: var(--cpd-space-6x);
2724
}
2825

2926
/* FIXME: rather than having EventTile's default CSS be for MessagePanel,
3027
we should make EventTile a base CSS class and customise it specifically
3128
for usage in {Message,File,Notification}Panel. */
3229

33-
.mx_EventTile_avatar {
34-
display: none;
35-
}
36-
3730
/* Overrides for the attachment body tiles */
3831
.mx_EventTile {
3932
word-break: break-word;
40-
margin-top: 10px;
4133
padding-top: 0;
4234

43-
.mx_EventTile_line {
44-
padding-inline-start: 0;
35+
& + .mx_EventTile {
36+
border-top: 1px solid var(--cpd-color-gray-400);
37+
padding-top: var(--cpd-space-6x);
4538
}
4639

47-
.mx_MFileBody {
48-
line-height: 2.4rem;
40+
.mx_EventTile_line {
41+
padding-inline-start: 0;
4942
}
5043

5144
.mx_MFileBody_download {
52-
padding-top: $spacing-8;
53-
display: flex;
54-
justify-content: space-between;
55-
font: var(--cpd-font-body-md-regular);
56-
color: $event-timestamp-color;
57-
58-
.mx_MImageBody_size {
59-
font: var(--cpd-font-body-md-regular);
60-
text-align: right;
61-
white-space: nowrap;
62-
}
63-
}
64-
65-
.mx_MFileBody_downloadLink {
66-
flex: 1 1 auto;
67-
color: $light-fg-color;
45+
margin-top: var(--cpd-space-4x);
6846
}
6947

7048
/* anchor link as wrapper */
7149
.mx_EventTile_senderDetailsLink {
7250
text-decoration: none;
51+
margin-bottom: var(--cpd-space-1x);
52+
display: block;
7353

7454
.mx_EventTile_senderDetails {
7555
display: flex;
76-
justify-content: space-between;
7756
margin-top: -2px;
57+
gap: var(--cpd-space-2x);
58+
align-items: center;
7859

7960
.mx_DisambiguatedProfile {
8061
color: $event-timestamp-color; /* for ellipsis. Color of displayName and mxid is inherited */
8162
}
8263

8364
.mx_MessageTimestamp {
84-
text-align: right;
85-
color: $secondary-content;
86-
font: var(--cpd-font-body-sm-regular);
65+
margin-left: auto;
66+
font: var(--cpd-font-body-xs-regular);
67+
color: var(--cpd-color-text-secondary);
8768
}
8869
}
8970
}

res/css/views/messages/_MFileBody.pcss

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,7 @@ Please see LICENSE files in the repository root for full details.
88

99
.mx_MFileBody_download {
1010
color: $accent;
11-
12-
.mx_MFileBody_download_icon {
13-
/* 12px instead of 14px to better match surrounding font size */
14-
width: 12px;
15-
height: 12px;
16-
mask-size: 12px;
17-
18-
mask-position: center;
19-
mask-repeat: no-repeat;
20-
mask-image: url("$(res)/img/download.svg");
21-
background-color: $accent;
22-
display: inline-block;
23-
}
24-
}
25-
26-
.mx_MFileBody_download a {
27-
color: $accent;
28-
text-decoration: none;
29-
cursor: pointer;
11+
height: var(--cpd-space-9x);
3012
}
3113

3214
.mx_MFileBody_download object {
@@ -43,12 +25,6 @@ Please see LICENSE files in the repository root for full details.
4325
padding: 0px;
4426
border: none;
4527
width: 100%;
46-
/* Set the height of the iframe to be 1 line of text.
47-
* Iframes don't automatically size themselves to fit their content.
48-
* So either we have to fix the height of the iframe using CSS or
49-
* use javascript's cross-origin postMessage API to communicate how
50-
* big the content of the iframe is. */
51-
height: 1.5em;
5228
}
5329

5430
.mx_MFileBody_info {
@@ -81,6 +57,8 @@ Please see LICENSE files in the repository root for full details.
8157
}
8258

8359
.mx_MFileBody_info_filename {
60+
font: var(--cpd-font-body-md-regular);
61+
color: var(--cpd-color-text-primary);
8462
text-overflow: ellipsis;
8563
overflow: hidden;
8664
white-space: nowrap;

0 commit comments

Comments
 (0)