Skip to content

Commit

Permalink
Use semantic headings in user settings Keyboard (#10793)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Kerry committed May 17, 2023
1 parent 38ae8e9 commit 68b1930
Show file tree
Hide file tree
Showing 3 changed files with 1,091 additions and 1,024 deletions.
43 changes: 19 additions & 24 deletions res/css/views/settings/tabs/user/_KeyboardUserSettingsTab.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,26 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_KeyboardUserSettingsTab .mx_SettingsTab_section {
ul {
margin: 0;
padding: 0;
}

.mx_KeyboardShortcut_shortcutRow,
.mx_KeyboardShortcut {
display: flex;
justify-content: space-between;
align-items: center;
}
.mx_KeyboardShortcut_shortcutList {
margin: 0;
padding: 0;
width: 100%;
display: grid;
grid-gap: $spacing-4;
}

.mx_KeyboardShortcut_shortcutRow {
column-gap: $spacing-8;
margin-bottom: $spacing-4;
.mx_KeyboardShortcut_shortcutRow,
.mx_KeyboardShortcut {
display: flex;
justify-content: space-between;
align-items: center;
}

/* TODO: Use flexbox */
&:last-of-type {
margin-bottom: 0;
}
.mx_KeyboardShortcut_shortcutRow {
column-gap: $spacing-8;
}

.mx_KeyboardShortcut {
flex-wrap: nowrap;
column-gap: 5px; /* TODO: Use a spacing variable */
}
}
.mx_KeyboardShortcut {
flex-wrap: nowrap;
column-gap: $spacing-4;
}
28 changes: 16 additions & 12 deletions src/components/views/settings/tabs/user/KeyboardUserSettingsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import {
getKeyboardShortcutValue,
} from "../../../../../accessibility/KeyboardShortcutUtils";
import { KeyboardShortcut } from "../../KeyboardShortcut";
import SettingsTab from "../SettingsTab";
import { SettingsSection } from "../../shared/SettingsSection";
import SettingsSubsection from "../../shared/SettingsSubsection";

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

return (
<div className="mx_SettingsTab_section" key={categoryName}>
<div className="mx_SettingsTab_subheading">{_t(category.categoryLabel)}</div>
<ul>
{" "}
<SettingsSubsection heading={_t(category.categoryLabel)} key={categoryName}>
<ul className="mx_KeyboardShortcut_shortcutList">
{category.settingNames.map((shortcutName) => {
return <KeyboardShortcutRow key={shortcutName} name={shortcutName} />;
})}{" "}
})}
</ul>
</div>
</SettingsSubsection>
);
};

const KeyboardUserSettingsTab: React.FC = () => {
return (
<div className="mx_SettingsTab mx_KeyboardUserSettingsTab">
<div className="mx_SettingsTab_heading">{_t("Keyboard")}</div>
{visibleCategories.map(([categoryName, category]) => {
return <KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />;
})}
</div>
<SettingsTab>
<SettingsSection heading={_t("Keyboard")}>
{visibleCategories.map(([categoryName, category]: [CategoryName, ICategory]) => {
return (
<KeyboardShortcutSection key={categoryName} categoryName={categoryName} category={category} />
);
})}
</SettingsSection>
</SettingsTab>
);
};

Expand Down
Loading

0 comments on commit 68b1930

Please sign in to comment.