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

Commit 68b1930

Browse files
author
Kerry
authored
Use semantic headings in user settings Keyboard (#10793)
* settingssubsection text component * use semantic headings in HelpUserSetttings tab * test * strict * lint * semantic heading in labs settings * semantic headings in keyboard settings tab * semantic heading in preferencesusersettingstab * tidying * findByTestId * prettier * allow testids in settings sections * use semantic headings in LabsUserSettingsTab * use semantic headings in usersettingspreferences * rethemendex * put back margin var
1 parent 38ae8e9 commit 68b1930

File tree

3 files changed

+1091
-1024
lines changed

3 files changed

+1091
-1024
lines changed

res/css/views/settings/tabs/user/_KeyboardUserSettingsTab.pcss

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,26 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
.mx_KeyboardUserSettingsTab .mx_SettingsTab_section {
19-
ul {
20-
margin: 0;
21-
padding: 0;
22-
}
23-
24-
.mx_KeyboardShortcut_shortcutRow,
25-
.mx_KeyboardShortcut {
26-
display: flex;
27-
justify-content: space-between;
28-
align-items: center;
29-
}
18+
.mx_KeyboardShortcut_shortcutList {
19+
margin: 0;
20+
padding: 0;
21+
width: 100%;
22+
display: grid;
23+
grid-gap: $spacing-4;
24+
}
3025

31-
.mx_KeyboardShortcut_shortcutRow {
32-
column-gap: $spacing-8;
33-
margin-bottom: $spacing-4;
26+
.mx_KeyboardShortcut_shortcutRow,
27+
.mx_KeyboardShortcut {
28+
display: flex;
29+
justify-content: space-between;
30+
align-items: center;
31+
}
3432

35-
/* TODO: Use flexbox */
36-
&:last-of-type {
37-
margin-bottom: 0;
38-
}
33+
.mx_KeyboardShortcut_shortcutRow {
34+
column-gap: $spacing-8;
35+
}
3936

40-
.mx_KeyboardShortcut {
41-
flex-wrap: nowrap;
42-
column-gap: 5px; /* TODO: Use a spacing variable */
43-
}
44-
}
37+
.mx_KeyboardShortcut {
38+
flex-wrap: nowrap;
39+
column-gap: $spacing-4;
4540
}

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import {
2525
getKeyboardShortcutValue,
2626
} from "../../../../../accessibility/KeyboardShortcutUtils";
2727
import { KeyboardShortcut } from "../../KeyboardShortcut";
28+
import SettingsTab from "../SettingsTab";
29+
import { SettingsSection } from "../../shared/SettingsSection";
30+
import SettingsSubsection from "../../shared/SettingsSubsection";
2831

2932
interface IKeyboardShortcutRowProps {
3033
name: KeyBindingAction;
@@ -57,26 +60,27 @@ const KeyboardShortcutSection: React.FC<IKeyboardShortcutSectionProps> = ({ cate
5760
if (!category.categoryLabel) return null;
5861

5962
return (
60-
<div className="mx_SettingsTab_section" key={categoryName}>
61-
<div className="mx_SettingsTab_subheading">{_t(category.categoryLabel)}</div>
62-
<ul>
63-
{" "}
63+
<SettingsSubsection heading={_t(category.categoryLabel)} key={categoryName}>
64+
<ul className="mx_KeyboardShortcut_shortcutList">
6465
{category.settingNames.map((shortcutName) => {
6566
return <KeyboardShortcutRow key={shortcutName} name={shortcutName} />;
66-
})}{" "}
67+
})}
6768
</ul>
68-
</div>
69+
</SettingsSubsection>
6970
);
7071
};
7172

7273
const KeyboardUserSettingsTab: React.FC = () => {
7374
return (
74-
<div className="mx_SettingsTab mx_KeyboardUserSettingsTab">
75-
<div className="mx_SettingsTab_heading">{_t("Keyboard")}</div>
76-
{visibleCategories.map(([categoryName, category]) => {
77-
return <KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />;
78-
})}
79-
</div>
75+
<SettingsTab>
76+
<SettingsSection heading={_t("Keyboard")}>
77+
{visibleCategories.map(([categoryName, category]: [CategoryName, ICategory]) => {
78+
return (
79+
<KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />
80+
);
81+
})}
82+
</SettingsSection>
83+
</SettingsTab>
8084
);
8185
};
8286

0 commit comments

Comments
 (0)