Navigation menu in Preferences (#2304)

This commit is contained in:
Alex Andreev authored and GitHub committed 2021-03-15 08:57:19 -04:00
1 parent 8e1583a59c
commit 5c373a886c
20 files changed
+838 -254

No files matched your search

+11 -4
View File
@@ -5,6 +5,7 @@ import { observer } from "mobx-react";
import { autobind, cssNames, IClassName } from "../../utils";
import { Icon } from "../icon";
import { navigation } from "../../navigation";
import { NavigationTree, RecursiveTreeView } from "../tree-view";
export interface PageLayoutProps extends React.DOMAttributes<any> {
className?: IClassName;
@@ -14,6 +15,7 @@ export interface PageLayoutProps extends React.DOMAttributes<any> {
provideBackButtonNavigation?: boolean;
contentGaps?: boolean;
showOnTop?: boolean; // covers whole app view
navigation?: NavigationTree[];
back?: (evt: React.MouseEvent | KeyboardEvent) => void;
}
@@ -57,9 +59,9 @@ export class PageLayout extends React.Component<PageLayoutProps> {
render() {
const {
contentClass, header, headerClass, provideBackButtonNavigation,
contentGaps, showOnTop, children, ...elemProps
contentGaps, showOnTop, navigation, children, ...elemProps
} = this.props;
const className = cssNames("PageLayout", { top: showOnTop }, this.props.className);
const className = cssNames("PageLayout", { showOnTop, showNavigation: navigation }, this.props.className);
return (
<div {...elemProps} className={className}>
@@ -73,8 +75,13 @@ export class PageLayout extends React.Component<PageLayoutProps> {
/>
)}
</div>
<div className="content-wrapper">
<div className={cssNames("content", contentGaps && "flex column gaps", contentClass)}>
{ navigation && (
<nav className="content-navigation">
<RecursiveTreeView data={navigation}/>
</nav>
)}
<div className="content-wrapper" id="ScrollSpyRoot">
<div className={cssNames("content", contentClass, contentGaps && "flex column gaps")}>
{children}
</div>
</div>