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

Commit b35fb4f

Browse files
author
Kerry
authored
Use semantic headings in user settings - profile (#10973)
* account password section * account email and phone numbers * update cypress selectors * use settingsection for General section * use semantic headings for profile settings * fix show advanced spacing * udpate snapshot
1 parent 5206592 commit b35fb4f

File tree

6 files changed

+13
-22
lines changed

6 files changed

+13
-22
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("General user settings tab", () => {
5353

5454
cy.findByTestId("mx_GeneralUserSettingsTab").within(() => {
5555
// Assert that the top heading is rendered
56-
cy.findByTestId("general").should("have.text", "General").should("be.visible");
56+
cy.findByText("General").should("be.visible");
5757

5858
cy.get(".mx_ProfileSettings_profile")
5959
.scrollIntoView()

res/css/views/settings/_ProfileSettings.pcss

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ limitations under the License.
1515
*/
1616

1717
.mx_ProfileSettings {
18-
margin-inline-end: var(--SettingsTab_fullWidthField-margin-inline-end);
1918
border-bottom: 1px solid $quinary-content;
2019

2120
.mx_ProfileSettings_avatarUpload {
@@ -29,8 +28,8 @@ limitations under the License.
2928
flex-grow: 1;
3029
margin-inline-end: 54px;
3130

32-
.mx_Field:first-child {
33-
margin-top: 0;
31+
.mx_Field {
32+
margin-top: $spacing-8;
3433
}
3534

3635
.mx_ProfileSettings_profile_controls_topic {

src/components/views/settings/ProfileSettings.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import AvatarSetting from "./AvatarSetting";
2929
import UserIdentifierCustomisations from "../../../customisations/UserIdentifier";
3030
import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds";
3131
import PosthogTrackers from "../../../PosthogTrackers";
32+
import { SettingsSubsectionHeading } from "./shared/SettingsSubsectionHeading";
3233

3334
interface IState {
3435
originalDisplayName: string;
@@ -183,7 +184,7 @@ export default class ProfileSettings extends React.Component<{}, IState> {
183184
/>
184185
<div className="mx_ProfileSettings_profile">
185186
<div className="mx_ProfileSettings_profile_controls">
186-
<span className="mx_SettingsTab_subheading">{_t("Profile")}</span>
187+
<SettingsSubsectionHeading heading={_t("Profile")} />
187188
<Field
188189
label={_t("Display Name")}
189190
type="text"

src/components/views/settings/tabs/user/AppearanceUserSettingsTab.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
136136
);
137137
}
138138
return (
139-
<SettingsSubsection heading={<></>}>
139+
<SettingsSubsection>
140140
{toggle}
141141
{advanced}
142142
</SettingsSubsection>

src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx

+6-15
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,6 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
320320
});
321321
};
322322

323-
private renderProfileSection(): JSX.Element {
324-
return (
325-
<div className="mx_SettingsTab_section">
326-
<ProfileSettings />
327-
</div>
328-
);
329-
}
330-
331323
private renderAccountSection(): JSX.Element {
332324
let threepidSection: ReactNode = null;
333325

@@ -558,13 +550,12 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
558550

559551
return (
560552
<SettingsTab data-testid="mx_GeneralUserSettingsTab">
561-
<div className="mx_SettingsTab_heading" data-testid="general">
562-
{_t("General")}
563-
</div>
564-
{this.renderProfileSection()}
565-
{this.renderAccountSection()}
566-
{this.renderLanguageSection()}
567-
{supportsMultiLanguageSpellCheck ? this.renderSpellCheckSection() : null}
553+
<SettingsSection heading={_t("General")}>
554+
<ProfileSettings />
555+
{this.renderAccountSection()}
556+
{this.renderLanguageSection()}
557+
{supportsMultiLanguageSpellCheck ? this.renderSpellCheckSection() : null}
558+
</SettingsSection>
568559
{discoverySection}
569560
{this.renderIntegrationManagerSection()}
570561
{accountManagementSection}

test/components/views/settings/tabs/user/__snapshots__/AppearanceUserSettingsTab-test.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
345345
class="mx_SettingsSubsection"
346346
>
347347
<div
348-
class="mx_SettingsSubsection_content"
348+
class="mx_SettingsSubsection_content mx_SettingsSubsection_noHeading"
349349
>
350350
<div
351351
aria-expanded="false"

0 commit comments

Comments
 (0)