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

Commit e9a8f4a

Browse files
author
Kerry
authored
Use semantic headings in space preferences (#11021)
* remove mx_SettingsTab_heading style * use semantic headings in space preferences dialog * remove unused settings style: mx_SettingsTab_subheading
1 parent 176daad commit e9a8f4a

File tree

5 files changed

+31
-69
lines changed

5 files changed

+31
-69
lines changed

res/css/views/dialogs/_SpacePreferencesDialog.pcss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,6 @@ limitations under the License.
3131

3232
.mx_SettingsTab {
3333
min-width: unset;
34-
35-
.mx_SettingsTab_section {
36-
font-size: $font-15px;
37-
line-height: $font-24px;
38-
39-
.mx_Checkbox + p {
40-
color: $secondary-content;
41-
margin: 0 20px 0 24px;
42-
}
43-
}
4434
}
4535
}
4636
}

res/css/views/dialogs/_SpaceSettingsDialog.pcss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ limitations under the License.
3737
margin-bottom: 20px;
3838
}
3939

40-
& + .mx_SettingsTab_subheading {
41-
border-top: 1px solid $menu-border-color;
42-
margin-top: 0;
43-
padding-top: 24px;
44-
}
45-
4640
.mx_StyledRadioButton {
4741
margin-top: 8px;
4842
margin-bottom: 4px;

res/css/views/settings/tabs/_SettingsTab.pcss

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ limitations under the License.
1515
*/
1616

1717
.mx_SettingsTab {
18-
--SettingsTab_heading_nth_child-margin-top: 30px; /* TODO: Use a spacing variable */
1918
--SettingsTab_tooltip-max-width: 120px; /* So it fits in the space provided by the page */
2019

2120
color: $primary-content;
@@ -47,29 +46,6 @@ limitations under the License.
4746
color: $alert;
4847
}
4948

50-
.mx_SettingsTab_heading {
51-
font-size: $font-20px;
52-
font-weight: var(--font-semi-bold);
53-
color: $primary-content;
54-
margin-top: 10px; /* TODO: Use a spacing variable */
55-
margin-bottom: 10px; /* TODO: Use a spacing variable */
56-
margin-right: 100px; /* TODO: Use a spacing variable */
57-
58-
&:nth-child(n + 2) {
59-
margin-top: var(--SettingsTab_heading_nth_child-margin-top);
60-
}
61-
}
62-
63-
.mx_SettingsTab_subheading {
64-
font-size: $font-16px;
65-
display: block;
66-
font-weight: var(--font-semi-bold);
67-
color: $primary-content;
68-
margin-top: $spacing-12;
69-
margin-bottom: 10px; /* TODO: Use a spacing variable */
70-
margin-right: 100px; /* TODO: Use a spacing variable */
71-
}
72-
7349
.mx_SettingsTab_subsectionText {
7450
color: $secondary-content;
7551
font-size: $font-14px;

src/components/views/dialogs/SpacePreferencesDialog.tsx

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ import { SettingLevel } from "../../../settings/SettingLevel";
2727
import RoomName from "../elements/RoomName";
2828
import { SpacePreferenceTab } from "../../../dispatcher/payloads/OpenSpacePreferencesPayload";
2929
import { NonEmptyArray } from "../../../@types/common";
30+
import SettingsTab from "../settings/tabs/SettingsTab";
31+
import { SettingsSection } from "../settings/shared/SettingsSection";
32+
import SettingsSubsection, { SettingsSubsectionText } from "../settings/shared/SettingsSubsection";
3033

3134
interface IProps {
3235
space: Room;
@@ -38,34 +41,34 @@ const SpacePreferencesAppearanceTab: React.FC<Pick<IProps, "space">> = ({ space
3841
const showPeople = useSettingValue("Spaces.showPeopleInSpace", space.roomId);
3942

4043
return (
41-
<div className="mx_SettingsTab">
42-
<div className="mx_SettingsTab_heading">{_t("Sections to show")}</div>
43-
44-
<div className="mx_SettingsTab_section">
45-
<StyledCheckbox
46-
checked={!!showPeople}
47-
onChange={(e: ChangeEvent<HTMLInputElement>) => {
48-
SettingsStore.setValue(
49-
"Spaces.showPeopleInSpace",
50-
space.roomId,
51-
SettingLevel.ROOM_ACCOUNT,
52-
!showPeople,
53-
);
54-
}}
55-
>
56-
{_t("People")}
57-
</StyledCheckbox>
58-
<p>
59-
{_t(
60-
"This groups your chats with members of this space. " +
61-
"Turning this off will hide those chats from your view of %(spaceName)s.",
62-
{
63-
spaceName: space.name,
64-
},
65-
)}
66-
</p>
67-
</div>
68-
</div>
44+
<SettingsTab>
45+
<SettingsSection heading={_t("Sections to show")}>
46+
<SettingsSubsection>
47+
<StyledCheckbox
48+
checked={!!showPeople}
49+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
50+
SettingsStore.setValue(
51+
"Spaces.showPeopleInSpace",
52+
space.roomId,
53+
SettingLevel.ROOM_ACCOUNT,
54+
!showPeople,
55+
);
56+
}}
57+
>
58+
{_t("People")}
59+
</StyledCheckbox>
60+
<SettingsSubsectionText>
61+
{_t(
62+
"This groups your chats with members of this space. " +
63+
"Turning this off will hide those chats from your view of %(spaceName)s.",
64+
{
65+
spaceName: space.name,
66+
},
67+
)}
68+
</SettingsSubsectionText>
69+
</SettingsSubsection>
70+
</SettingsSection>
71+
</SettingsTab>
6972
);
7073
};
7174

test/components/views/dialogs/UserSettingsDialog-test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ describe("<UserSettingsDialog />", () => {
7575
const getActiveTabLabel = (container: Element) =>
7676
container.querySelector(".mx_TabbedView_tabLabel_active")?.textContent;
7777
const getActiveTabHeading = (container: Element) =>
78-
container.querySelector(".mx_SettingsTab_heading")?.textContent ||
7978
container.querySelector(".mx_SettingsSection .mx_Heading_h2")?.textContent;
8079

8180
it("should render general settings tab when no initialTabId", () => {

0 commit comments

Comments
 (0)