Fix font & spaces in settings subsection (#28631)

* Fix settings header

* Fix gap between subsection

* Update tests

* Update e2e tests

* Update snapshots
This commit is contained in:
Florian Duros 2024-12-04 15:11:02 +01:00 committed by GitHub
parent db5b3359c6
commit 5a418f3f19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 19 additions and 18 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Before After
Before After

View file

@ -13,7 +13,16 @@ Please see LICENSE files in the repository root for full details.
&.mx_SettingsSubsection_newUi { &.mx_SettingsSubsection_newUi {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--cpd-space-8x); gap: var(--cpd-space-6x);
}
*[role="separator"] {
/**
* The gap between subsections is 32px and inside the subsection is 24px.
* The separator separates the subsections, so it should have the same gap as the subsections.
* We add 12px and the separator spacing to the top margin to make the separator visually centered between the subsections.
*/
margin-top: calc(var(--cpd-space-3x) + var(--cpd-separator-spacing));
} }
} }

View file

@ -45,7 +45,7 @@ export const SettingsSubsection: React.FC<SettingsSubsectionProps> = ({
mx_SettingsSubsection_newUi: !legacy, mx_SettingsSubsection_newUi: !legacy,
})} })}
> >
{typeof heading === "string" ? <SettingsSubsectionHeading heading={heading} legacy={legacy} /> : <>{heading}</>} {typeof heading === "string" ? <SettingsSubsectionHeading heading={heading} /> : <>{heading}</>}
{!!description && ( {!!description && (
<div className="mx_SettingsSubsection_description"> <div className="mx_SettingsSubsection_description">
<SettingsSubsectionText>{description}</SettingsSubsectionText> <SettingsSubsectionText>{description}</SettingsSubsectionText>

View file

@ -12,21 +12,13 @@ import Heading from "../../typography/Heading";
export interface SettingsSubsectionHeadingProps extends HTMLAttributes<HTMLDivElement> { export interface SettingsSubsectionHeadingProps extends HTMLAttributes<HTMLDivElement> {
heading: string; heading: string;
legacy?: boolean;
children?: React.ReactNode; children?: React.ReactNode;
} }
export const SettingsSubsectionHeading: React.FC<SettingsSubsectionHeadingProps> = ({ export const SettingsSubsectionHeading: React.FC<SettingsSubsectionHeadingProps> = ({ heading, children, ...rest }) => {
heading,
legacy = true,
children,
...rest
}) => {
const size = legacy ? "4" : "3";
return ( return (
<div {...rest} className="mx_SettingsSubsectionHeading"> <div {...rest} className="mx_SettingsSubsectionHeading">
<Heading className="mx_SettingsSubsectionHeading_heading" size={size} as="h3"> <Heading className="mx_SettingsSubsectionHeading_heading" size="4" as="h3">
{heading} {heading}
</Heading> </Heading>
{children} {children}

View file

@ -10,7 +10,7 @@ exports[`<LayoutSwitcher /> should render 1`] = `
class="mx_SettingsSubsectionHeading" class="mx_SettingsSubsectionHeading"
> >
<h3 <h3
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
> >
Message layout Message layout
</h3> </h3>

View file

@ -10,7 +10,7 @@ exports[`<ThemeChoicePanel /> custom theme should display custom theme 1`] = `
class="mx_SettingsSubsectionHeading" class="mx_SettingsSubsectionHeading"
> >
<h3 <h3
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
> >
Theme Theme
</h3> </h3>
@ -287,7 +287,7 @@ exports[`<ThemeChoicePanel /> custom theme should render the custom theme sectio
class="mx_SettingsSubsectionHeading" class="mx_SettingsSubsectionHeading"
> >
<h3 <h3
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
> >
Theme Theme
</h3> </h3>
@ -564,7 +564,7 @@ exports[`<ThemeChoicePanel /> renders the theme choice UI 1`] = `
class="mx_SettingsSubsectionHeading" class="mx_SettingsSubsectionHeading"
> >
<h3 <h3
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
> >
Theme Theme
</h3> </h3>

View file

@ -23,7 +23,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
class="mx_SettingsSubsectionHeading" class="mx_SettingsSubsectionHeading"
> >
<h3 <h3
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
> >
Theme Theme
</h3> </h3>
@ -153,7 +153,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
class="mx_SettingsSubsectionHeading" class="mx_SettingsSubsectionHeading"
> >
<h3 <h3
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading" class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
> >
Message layout Message layout
</h3> </h3>