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

Commit 9c7d935

Browse files
author
Germain
authored
Compound Typography pass (#11103)
* Integrate compound design tokens The icons should not be included in this repo, and should live in the compound design token repo, but for simplicity sake at this phase of the integration they will be added here * Delete unused or incorrect - sass variables * Typography pass * Deprecate _font-weights.pcss and use Compound instead * lint fix * Fix snapshot * Fix typography pass feedback * Remove unwanted e2e test cypress tests should test functionality not visual output. And we should not test visual output by inspecting CSS properties * lintfix * Migration script for baseFontSize * Updates after design review * Update font scaling panel to use min/max size * Fix custom font * Fix font slider e2e test * Update custom font * Update new baseFontSizeV2 * Disambiguate heading props * Fix appearance test * change max font size * fix e2ee test * fix tests * test baseFontSize migration code * typescript strict * Migrate baseFontSize account setting * Change assertion for font size * Fix font size controller test
1 parent ce479c5 commit 9c7d935

File tree

199 files changed

+606
-608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+606
-608
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,6 @@ describe("FilePanel", () => {
238238
});
239239
});
240240
});
241-
242-
it("should not add inline padding to a tile when it is selected with right click", () => {
243-
// Upload a file
244-
uploadFile("cypress/fixtures/1sec.ogg");
245-
246-
cy.get(".mx_FilePanel .mx_RoomView_MessageList").within(() => {
247-
// Wait until the spinner of the audio player vanishes
248-
cy.get(".mx_InlineSpinner").should("not.exist");
249-
250-
// Right click the uploaded file to select the tile
251-
cy.get(".mx_EventTile").rightclick();
252-
253-
// Assert that inline padding is not applied
254-
cy.get(".mx_EventTile_selected .mx_EventTile_line").should("have.css", "padding-inline", "0px");
255-
});
256-
});
257241
});
258242

259243
describe("download", () => {

cypress/e2e/settings/appearance-user-settings-tab.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ describe("Appearance user settings tab", () => {
122122
// Click the left position of the slider
123123
cy.get("input").realClick({ position: "left" });
124124

125+
const MIN_FONT_SIZE = 11;
125126
// Assert that the smallest font size is selected
126-
cy.get("input[value='13']").should("exist");
127-
cy.get("output .mx_Slider_selection_label").findByText("13");
127+
cy.get(`input[value='${MIN_FONT_SIZE}']`).should("exist");
128+
cy.get("output .mx_Slider_selection_label").findByText(MIN_FONT_SIZE);
128129
});
129130

130131
cy.get(".mx_FontScalingPanel_fontSlider").percySnapshotElement("Font size slider - smallest (13)", {
@@ -135,12 +136,13 @@ describe("Appearance user settings tab", () => {
135136
// Click the right position of the slider
136137
cy.get("input").realClick({ position: "right" });
137138

139+
const MAX_FONT_SIZE = 21;
138140
// Assert that the largest font size is selected
139-
cy.get("input[value='18']").should("exist");
140-
cy.get("output .mx_Slider_selection_label").findByText("18");
141+
cy.get(`input[value='${MAX_FONT_SIZE}']`).should("exist");
142+
cy.get("output .mx_Slider_selection_label").findByText(MAX_FONT_SIZE);
141143
});
142144

143-
cy.get(".mx_FontScalingPanel_fontSlider").percySnapshotElement("Font size slider - largest (18)", {
145+
cy.get(".mx_FontScalingPanel_fontSlider").percySnapshotElement("Font size slider - largest (21)", {
144146
widths: [486],
145147
});
146148
});

cypress/e2e/timeline/timeline.spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,6 @@ describe("Timeline", () => {
204204
cy.findByRole("button", { name: "collapse" }).should("exist");
205205
});
206206

207-
// Check the height of expanded GELS line
208-
cy.get(".mx_GenericEventListSummary[data-layout=irc] .mx_GenericEventListSummary_spacer").should(
209-
"have.css",
210-
"line-height",
211-
"18px", // var(--irc-line-height): $font-18px (See: _IRCLayout.pcss)
212-
);
213-
214207
cy.get(".mx_MainSplit").percySnapshotElement("Expanded GELS on IRC layout", { percyCSS });
215208
});
216209

@@ -238,13 +231,6 @@ describe("Timeline", () => {
238231
cy.findByRole("button", { name: "collapse" }).should("exist");
239232
});
240233

241-
// Check the height of expanded GELS line
242-
cy.get(".mx_GenericEventListSummary[data-layout=group] .mx_GenericEventListSummary_spacer").should(
243-
"have.css",
244-
"line-height",
245-
"22px", // $font-22px (See: _GenericEventListSummary.pcss)
246-
);
247-
248234
cy.get(".mx_MainSplit").percySnapshotElement("Expanded GELS on modern layout", { percyCSS });
249235
});
250236

res/css/_common.pcss

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Copyright 2015, 2016 OpenMarket Ltd
33
Copyright 2017 Vector Creations Ltd
44
Copyright 2017 - 2019 New Vector Ltd
5-
Copyright 2019 - 2021 The Matrix.org Foundation C.I.C
5+
Copyright 2019 - 2023 The Matrix.org Foundation C.I.C
66
77
Licensed under the Apache License, Version 2.0 (the "License");
88
you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ limitations under the License.
1919

2020
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css");
2121
@import "./_font-sizes.pcss";
22-
@import "./_font-weights.pcss";
2322
@import "./_animations.pcss";
2423
@import "./_spacing.pcss";
2524
@import url("maplibre-gl/dist/maplibre-gl.css");
@@ -77,8 +76,9 @@ html {
7776
}
7877

7978
body {
80-
font-family: $font-family;
81-
font-size: $font-15px;
79+
font: var(--cpd-font-body-md-regular);
80+
letter-spacing: var(--cpd-font-letter-spacing-body-md);
81+
8282
background-color: $background;
8383
color: $primary-content;
8484
border: 0px;
@@ -119,8 +119,8 @@ b {
119119

120120
h2 {
121121
color: $primary-content;
122-
font-weight: 400;
123-
font-size: $font-18px;
122+
font: var(--cpd-font-heading-lg-regular);
123+
letter-spacing: var(--cpd-font-letter-spacing-heading-lg);
124124
margin-top: 16px;
125125
margin-bottom: 16px;
126126
}
@@ -134,10 +134,9 @@ a:visited {
134134
input[type="text"],
135135
input[type="search"],
136136
input[type="password"] {
137-
font-family: inherit;
138137
padding: 9px;
139-
font-size: $font-14px;
140-
font-weight: var(--font-semi-bold);
138+
font: var(--cpd-font-body-md-semibold);
139+
font-weight: var(--cpd-font-weight-semibold);
141140
min-width: 0;
142141
}
143142

@@ -337,11 +336,9 @@ legend {
337336

338337
/* Styles copied/inspired by GroupLayout, ReplyTile, and EventTile variants. */
339338
.markdown-body {
340-
font-family: inherit !important;
341-
white-space: normal !important;
342-
line-height: inherit !important;
339+
font: var(--cpd-font-body-md-regular) !important;
340+
letter-spacing: var(--cpd-font-letter-spacing-body-md);
343341
color: inherit; /* inherit the colour from the dark or light theme by default (but not for code blocks) */
344-
font-size: $font-14px;
345342

346343
pre,
347344
code {
@@ -498,7 +495,7 @@ legend {
498495

499496
.mx_Dialog_content {
500497
margin: 24px 0 68px;
501-
font-size: $font-14px;
498+
font: var(--cpd-font-body-md-regular);
502499
color: $primary-content;
503500
word-wrap: break-word;
504501
}
@@ -535,8 +532,7 @@ legend {
535532
vertical-align: middle;
536533
border: 0px;
537534
border-radius: 8px;
538-
font-family: $font-family;
539-
font-size: $font-14px;
535+
font: var(--cpd-font-body-md-regular);
540536
color: $button-fg-color;
541537
background-color: $accent;
542538
width: auto;
@@ -570,7 +566,7 @@ legend {
570566
margin-bottom: 5px;
571567

572568
/* flip colours for the secondary ones */
573-
font-weight: var(--font-semi-bold);
569+
font-weight: var(--cpd-font-weight-semibold);
574570
border: 1px solid $accent;
575571
color: $accent;
576572
background-color: $button-secondary-bg-color;
@@ -758,7 +754,7 @@ legend {
758754

759755
@define-mixin LegacyCallButton {
760756
box-sizing: border-box;
761-
font-weight: var(--font-semi-bold);
757+
font-weight: var(--cpd-font-weight-semibold);
762758
height: $font-24px;
763759
line-height: $font-24px;
764760
margin-right: 0;
@@ -780,7 +776,7 @@ legend {
780776

781777
@define-mixin ThreadRepliesAmount {
782778
color: $secondary-content;
783-
font-weight: var(--font-semi-bold);
779+
font-weight: var(--cpd-font-weight-semibold);
784780
white-space: nowrap;
785781
position: relative;
786782
padding: 0 $spacing-12 0 $spacing-8;

res/css/_components.pcss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
@import "./_animations.pcss";
33
@import "./_common.pcss";
44
@import "./_font-sizes.pcss";
5-
@import "./_font-weights.pcss";
65
@import "./_spacing.pcss";
76
@import "./components/views/beacon/_BeaconListItem.pcss";
87
@import "./components/views/beacon/_BeaconStatus.pcss";

res/css/_font-sizes.pcss

Lines changed: 29 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -21,63 +21,33 @@ limitations under the License.
2121
* "Font size" setting). They exist to make the job of converting designs (which tend to be based in pixels) into CSS
2222
* easier.
2323
*
24-
* That means that, slightly confusingly, `$font-10px` is only *actually* 10px at the default font size: at a base
25-
* `font-size` of 15, it is actually 15px.
2624
*/
27-
$font-1px: 0.1rem;
28-
$font-1-5px: 0.15rem;
29-
$font-2px: 0.2rem;
30-
$font-3px: 0.3rem;
31-
$font-4px: 0.4rem;
32-
$font-5px: 0.5rem;
33-
$font-6px: 0.6rem;
34-
$font-7px: 0.7rem;
35-
$font-8px: 0.8rem;
36-
$font-9px: 0.9rem;
37-
$font-10px: 1rem;
38-
$font-10-4px: 1.04rem;
39-
$font-11px: 1.1rem;
40-
$font-12px: 1.2rem;
41-
$font-13px: 1.3rem;
42-
$font-14px: 1.4rem;
43-
$font-15px: 1.5rem;
44-
$font-16px: 1.6rem;
45-
$font-17px: 1.7rem;
46-
$font-18px: 1.8rem;
47-
$font-19px: 1.9rem;
48-
$font-20px: 2rem;
49-
$font-21px: 2.1rem;
50-
$font-22px: 2.2rem;
51-
$font-23px: 2.3rem;
52-
$font-24px: 2.4rem;
53-
$font-25px: 2.5rem;
54-
$font-26px: 2.6rem;
55-
$font-27px: 2.7rem;
56-
$font-28px: 2.8rem;
57-
$font-29px: 2.9rem;
58-
$font-30px: 3rem;
59-
$font-31px: 3.1rem;
60-
$font-32px: 3.2rem;
61-
$font-33px: 3.3rem;
62-
$font-34px: 3.4rem;
63-
$font-35px: 3.5rem;
64-
$font-36px: 3.6rem;
65-
$font-37px: 3.7rem;
66-
$font-38px: 3.8rem;
67-
$font-39px: 3.9rem;
68-
$font-40px: 4rem;
69-
$font-41px: 4.1rem;
70-
$font-42px: 4.2rem;
71-
$font-43px: 4.3rem;
72-
$font-44px: 4.4rem;
73-
$font-45px: 4.5rem;
74-
$font-46px: 4.6rem;
75-
$font-47px: 4.7rem;
76-
$font-48px: 4.8rem;
77-
$font-49px: 4.9rem;
78-
$font-50px: 5rem;
79-
$font-51px: 5.1rem;
80-
$font-52px: 5.2rem;
81-
$font-78px: 7.8rem;
82-
$font-88px: 8.8rem;
83-
$font-400px: 40rem;
25+
$font-1px: 0.0625rem;
26+
$font-8px: 0.5rem;
27+
$font-9px: 0.5625rem;
28+
$font-10px: 0.625rem;
29+
$font-10-4px: 0.6275rem;
30+
$font-11px: 0.6875rem;
31+
$font-12px: 0.75rem;
32+
$font-13px: 0.8125rem;
33+
$font-14px: 0.875rem;
34+
$font-15px: 0.9375rem;
35+
$font-16px: 1rem;
36+
$font-17px: 1.0625rem;
37+
$font-18px: 1.125rem;
38+
$font-20px: 1.25rem;
39+
$font-22px: 1.375rem;
40+
$font-23px: 1.4375rem;
41+
$font-24px: 1.5rem;
42+
$font-25px: 1.5625rem;
43+
$font-26px: 1.625rem;
44+
$font-28px: 1.75rem;
45+
$font-29px: 1.8125rem;
46+
$font-30px: 1.875rem;
47+
$font-32px: 2rem;
48+
$font-34px: 2.125rem;
49+
$font-35px: 2.1875rem;
50+
$font-39px: 2.4375rem;
51+
$font-42px: 2.625rem;
52+
$font-44px: 2.75rem;
53+
$font-48px: 3rem;

res/css/_font-weights.pcss

Lines changed: 0 additions & 20 deletions
This file was deleted.

res/css/components/views/beacon/_BeaconListItem.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ limitations under the License.
5555
margin-bottom: $spacing-8;
5656

5757
.mx_BeaconStatus_label {
58-
font-weight: var(--font-semi-bold);
58+
font-weight: var(--cpd-font-weight-semibold);
5959
}
6060
}
6161

res/css/components/views/beacon/_DialogSidebar.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ limitations under the License.
5757
}
5858

5959
.mx_DialogSidebar_noResults {
60-
font-size: $font-14px;
60+
font: var(--cpd-font-body-md-regular);
6161
color: $secondary-content;
6262
}

res/css/components/views/beacon/_OwnBeaconStatus.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ limitations under the License.
2727
.mx_OwnBeaconStatus_destructiveButton {
2828
/* override button link_inline styles */
2929
color: $alert !important;
30-
font-weight: var(--font-semi-bold) !important;
30+
font-weight: var(--cpd-font-weight-semibold) !important;
3131
}

res/css/components/views/elements/_AppPermission.pcss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ limitations under the License.
1919
font-size: $font-12px;
2020
width: 100%; /* make mx_AppPermission fill width of mx_AppTileBody so that scroll bar appears on the edge */
2121
overflow-y: scroll;
22-
22+
.mx_AppPermission_bolder {
23+
font-weight: var(--cpd-font-weight-semibold);
24+
}
2325
.mx_AppPermission_content {
2426
margin-block: auto; /* place at the center */
2527

res/css/components/views/elements/_FilterDropdown.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ limitations under the License.
7272
}
7373

7474
.mx_FilterDropdown_optionLabel {
75-
font-weight: var(--font-semi-bold);
75+
font-weight: var(--cpd-font-weight-semibold);
7676
display: block;
7777
}
7878

res/css/components/views/elements/_FilterTabGroup.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ limitations under the License.
3838

3939
&:checked + span {
4040
color: $accent;
41-
font-weight: var(--font-semi-bold);
41+
font-weight: var(--cpd-font-weight-semibold);
4242
// underline
4343
box-shadow: 0 1.5px 0 0 currentColor;
4444
}

res/css/components/views/pips/_WidgetPip.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ limitations under the License.
4242
padding: $spacing-12;
4343
display: flex;
4444
font-size: $font-12px;
45-
font-weight: var(--font-semi-bold);
45+
font-weight: var(--cpd-font-weight-semibold);
4646
background: linear-gradient(rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
4747
}
4848

res/css/components/views/settings/devices/_DeviceSecurityCard.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ limitations under the License.
6565
}
6666
.mx_DeviceSecurityCard_description {
6767
margin: 0;
68-
font-size: $font-12px;
68+
font: var(--cpd-font-body-sm-regular);
6969
color: $secondary-content;
7070
}
7171

res/css/components/views/spaces/_QuickThemeSwitcher.pcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ limitations under the License.
3030
}
3131

3232
.mx_QuickThemeSwitcher_heading {
33-
font-weight: var(--font-semi-bold);
33+
font-weight: var(--cpd-font-weight-semibold);
3434
font-size: $font-12px;
3535
line-height: $font-15px;
3636
color: $secondary-content;

0 commit comments

Comments
 (0)