Skip to content

Commit 5a418f3

Browse files
authored
Fix font & spaces in settings subsection (element-hq#28631)
* Fix settings header * Fix gap between subsection * Update tests * Update e2e tests * Update snapshots
1 parent db5b335 commit 5a418f3

File tree

13 files changed

+19
-18
lines changed

13 files changed

+19
-18
lines changed

res/css/components/views/settings/shared/_SettingsSubsection.pcss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ Please see LICENSE files in the repository root for full details.
1313
&.mx_SettingsSubsection_newUi {
1414
display: flex;
1515
flex-direction: column;
16-
gap: var(--cpd-space-8x);
16+
gap: var(--cpd-space-6x);
17+
}
18+
19+
*[role="separator"] {
20+
/**
21+
* The gap between subsections is 32px and inside the subsection is 24px.
22+
* The separator separates the subsections, so it should have the same gap as the subsections.
23+
* We add 12px and the separator spacing to the top margin to make the separator visually centered between the subsections.
24+
*/
25+
margin-top: calc(var(--cpd-space-3x) + var(--cpd-separator-spacing));
1726
}
1827
}
1928

src/components/views/settings/shared/SettingsSubsection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const SettingsSubsection: React.FC<SettingsSubsectionProps> = ({
4545
mx_SettingsSubsection_newUi: !legacy,
4646
})}
4747
>
48-
{typeof heading === "string" ? <SettingsSubsectionHeading heading={heading} legacy={legacy} /> : <>{heading}</>}
48+
{typeof heading === "string" ? <SettingsSubsectionHeading heading={heading} /> : <>{heading}</>}
4949
{!!description && (
5050
<div className="mx_SettingsSubsection_description">
5151
<SettingsSubsectionText>{description}</SettingsSubsectionText>

src/components/views/settings/shared/SettingsSubsectionHeading.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,13 @@ import Heading from "../../typography/Heading";
1212

1313
export interface SettingsSubsectionHeadingProps extends HTMLAttributes<HTMLDivElement> {
1414
heading: string;
15-
legacy?: boolean;
1615
children?: React.ReactNode;
1716
}
1817

19-
export const SettingsSubsectionHeading: React.FC<SettingsSubsectionHeadingProps> = ({
20-
heading,
21-
legacy = true,
22-
children,
23-
...rest
24-
}) => {
25-
const size = legacy ? "4" : "3";
26-
18+
export const SettingsSubsectionHeading: React.FC<SettingsSubsectionHeadingProps> = ({ heading, children, ...rest }) => {
2719
return (
2820
<div {...rest} className="mx_SettingsSubsectionHeading">
29-
<Heading className="mx_SettingsSubsectionHeading_heading" size={size} as="h3">
21+
<Heading className="mx_SettingsSubsectionHeading_heading" size="4" as="h3">
3022
{heading}
3123
</Heading>
3224
{children}

test/unit-tests/components/views/settings/__snapshots__/LayoutSwitcher-test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports[`<LayoutSwitcher /> should render 1`] = `
1010
class="mx_SettingsSubsectionHeading"
1111
>
1212
<h3
13-
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading"
13+
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
1414
>
1515
Message layout
1616
</h3>

test/unit-tests/components/views/settings/__snapshots__/ThemeChoicePanel-test.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exports[`<ThemeChoicePanel /> custom theme should display custom theme 1`] = `
1010
class="mx_SettingsSubsectionHeading"
1111
>
1212
<h3
13-
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading"
13+
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
1414
>
1515
Theme
1616
</h3>
@@ -287,7 +287,7 @@ exports[`<ThemeChoicePanel /> custom theme should render the custom theme sectio
287287
class="mx_SettingsSubsectionHeading"
288288
>
289289
<h3
290-
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading"
290+
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
291291
>
292292
Theme
293293
</h3>
@@ -564,7 +564,7 @@ exports[`<ThemeChoicePanel /> renders the theme choice UI 1`] = `
564564
class="mx_SettingsSubsectionHeading"
565565
>
566566
<h3
567-
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading"
567+
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
568568
>
569569
Theme
570570
</h3>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
2323
class="mx_SettingsSubsectionHeading"
2424
>
2525
<h3
26-
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading"
26+
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
2727
>
2828
Theme
2929
</h3>
@@ -153,7 +153,7 @@ exports[`AppearanceUserSettingsTab should render 1`] = `
153153
class="mx_SettingsSubsectionHeading"
154154
>
155155
<h3
156-
class="mx_Heading_h3 mx_SettingsSubsectionHeading_heading"
156+
class="mx_Heading_h4 mx_SettingsSubsectionHeading_heading"
157157
>
158158
Message layout
159159
</h3>

0 commit comments

Comments
 (0)