Skip to content

Commit

Permalink
Use semantic headings in user settings - profile (#10973)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Kerry committed May 29, 2023
1 parent 5206592 commit b35fb4f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/settings/general-user-settings-tab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("General user settings tab", () => {

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

cy.get(".mx_ProfileSettings_profile")
.scrollIntoView()
Expand Down
5 changes: 2 additions & 3 deletions res/css/views/settings/_ProfileSettings.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
*/

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

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

.mx_Field:first-child {
margin-top: 0;
.mx_Field {
margin-top: $spacing-8;
}

.mx_ProfileSettings_profile_controls_topic {
Expand Down
3 changes: 2 additions & 1 deletion src/components/views/settings/ProfileSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import AvatarSetting from "./AvatarSetting";
import UserIdentifierCustomisations from "../../../customisations/UserIdentifier";
import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds";
import PosthogTrackers from "../../../PosthogTrackers";
import { SettingsSubsectionHeading } from "./shared/SettingsSubsectionHeading";

interface IState {
originalDisplayName: string;
Expand Down Expand Up @@ -183,7 +184,7 @@ export default class ProfileSettings extends React.Component<{}, IState> {
/>
<div className="mx_ProfileSettings_profile">
<div className="mx_ProfileSettings_profile_controls">
<span className="mx_SettingsTab_subheading">{_t("Profile")}</span>
<SettingsSubsectionHeading heading={_t("Profile")} />
<Field
label={_t("Display Name")}
type="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
);
}
return (
<SettingsSubsection heading={<></>}>
<SettingsSubsection>
{toggle}
{advanced}
</SettingsSubsection>
Expand Down
21 changes: 6 additions & 15 deletions src/components/views/settings/tabs/user/GeneralUserSettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,6 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
});
};

private renderProfileSection(): JSX.Element {
return (
<div className="mx_SettingsTab_section">
<ProfileSettings />
</div>
);
}

private renderAccountSection(): JSX.Element {
let threepidSection: ReactNode = null;

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

return (
<SettingsTab data-testid="mx_GeneralUserSettingsTab">
<div className="mx_SettingsTab_heading" data-testid="general">
{_t("General")}
</div>
{this.renderProfileSection()}
{this.renderAccountSection()}
{this.renderLanguageSection()}
{supportsMultiLanguageSpellCheck ? this.renderSpellCheckSection() : null}
<SettingsSection heading={_t("General")}>
<ProfileSettings />
{this.renderAccountSection()}
{this.renderLanguageSection()}
{supportsMultiLanguageSpellCheck ? this.renderSpellCheckSection() : null}
</SettingsSection>
{discoverySection}
{this.renderIntegrationManagerSection()}
{accountManagementSection}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
class="mx_SettingsSubsection"
>
<div
class="mx_SettingsSubsection_content"
class="mx_SettingsSubsection_content mx_SettingsSubsection_noHeading"
>
<div
aria-expanded="false"
Expand Down

0 comments on commit b35fb4f

Please sign in to comment.