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
This commit is contained in:
Kerry 2023-05-29 13:36:09 +12:00 committed by GitHub
parent 520659242b
commit b35fb4fed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 22 deletions

View file

@ -53,7 +53,7 @@ describe("General user settings tab", () => {
cy.findByTestId("mx_GeneralUserSettingsTab").within(() => { cy.findByTestId("mx_GeneralUserSettingsTab").within(() => {
// Assert that the top heading is rendered // 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") cy.get(".mx_ProfileSettings_profile")
.scrollIntoView() .scrollIntoView()

View file

@ -15,7 +15,6 @@ limitations under the License.
*/ */
.mx_ProfileSettings { .mx_ProfileSettings {
margin-inline-end: var(--SettingsTab_fullWidthField-margin-inline-end);
border-bottom: 1px solid $quinary-content; border-bottom: 1px solid $quinary-content;
.mx_ProfileSettings_avatarUpload { .mx_ProfileSettings_avatarUpload {
@ -29,8 +28,8 @@ limitations under the License.
flex-grow: 1; flex-grow: 1;
margin-inline-end: 54px; margin-inline-end: 54px;
.mx_Field:first-child { .mx_Field {
margin-top: 0; margin-top: $spacing-8;
} }
.mx_ProfileSettings_profile_controls_topic { .mx_ProfileSettings_profile_controls_topic {

View file

@ -29,6 +29,7 @@ import AvatarSetting from "./AvatarSetting";
import UserIdentifierCustomisations from "../../../customisations/UserIdentifier"; import UserIdentifierCustomisations from "../../../customisations/UserIdentifier";
import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds"; import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds";
import PosthogTrackers from "../../../PosthogTrackers"; import PosthogTrackers from "../../../PosthogTrackers";
import { SettingsSubsectionHeading } from "./shared/SettingsSubsectionHeading";
interface IState { interface IState {
originalDisplayName: string; originalDisplayName: string;
@ -183,7 +184,7 @@ export default class ProfileSettings extends React.Component<{}, IState> {
/> />
<div className="mx_ProfileSettings_profile"> <div className="mx_ProfileSettings_profile">
<div className="mx_ProfileSettings_profile_controls"> <div className="mx_ProfileSettings_profile_controls">
<span className="mx_SettingsTab_subheading">{_t("Profile")}</span> <SettingsSubsectionHeading heading={_t("Profile")} />
<Field <Field
label={_t("Display Name")} label={_t("Display Name")}
type="text" type="text"

View file

@ -136,7 +136,7 @@ export default class AppearanceUserSettingsTab extends React.Component<IProps, I
); );
} }
return ( return (
<SettingsSubsection heading={<></>}> <SettingsSubsection>
{toggle} {toggle}
{advanced} {advanced}
</SettingsSubsection> </SettingsSubsection>

View file

@ -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 { private renderAccountSection(): JSX.Element {
let threepidSection: ReactNode = null; let threepidSection: ReactNode = null;
@ -558,13 +550,12 @@ export default class GeneralUserSettingsTab extends React.Component<IProps, ISta
return ( return (
<SettingsTab data-testid="mx_GeneralUserSettingsTab"> <SettingsTab data-testid="mx_GeneralUserSettingsTab">
<div className="mx_SettingsTab_heading" data-testid="general"> <SettingsSection heading={_t("General")}>
{_t("General")} <ProfileSettings />
</div> {this.renderAccountSection()}
{this.renderProfileSection()} {this.renderLanguageSection()}
{this.renderAccountSection()} {supportsMultiLanguageSpellCheck ? this.renderSpellCheckSection() : null}
{this.renderLanguageSection()} </SettingsSection>
{supportsMultiLanguageSpellCheck ? this.renderSpellCheckSection() : null}
{discoverySection} {discoverySection}
{this.renderIntegrationManagerSection()} {this.renderIntegrationManagerSection()}
{accountManagementSection} {accountManagementSection}

View file

@ -345,7 +345,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
class="mx_SettingsSubsection" class="mx_SettingsSubsection"
> >
<div <div
class="mx_SettingsSubsection_content" class="mx_SettingsSubsection_content mx_SettingsSubsection_noHeading"
> >
<div <div
aria-expanded="false" aria-expanded="false"