From 137f09c2c0db4d7b397c9f0cd3a11cc7d1b0392f Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Thu, 25 Mar 2021 16:18:00 +0300 Subject: [PATCH] Adding Tab navigation to Preferences Signed-off-by: Alex Andreev --- .../components/+preferences/preferences.tsx | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index eada7eb41e..d0314ba4cc 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -15,13 +15,20 @@ import { SubTitle } from "../layout/sub-title"; import { Select, SelectOption } from "../select"; import { HelmCharts } from "./helm-charts"; import { KubectlBinaries } from "./kubectl-binaries"; -import { ScrollSpy } from "../scroll-spy/scroll-spy"; import { navigation } from "../../navigation"; +import { Tab, Tabs } from "../tabs"; + +enum PreferencesTab { + Application = "application", + Kubernetes = "kubernetes", + Extensions = "extensions" +} @observer export class Preferences extends React.Component { @observable httpProxy = userStore.preferences.httpsProxy || ""; @observable shell = userStore.preferences.shell || ""; + @observable activeTab = PreferencesTab.Application; @computed get themeOptions(): SelectOption[] { return themeStore.themes.map(theme => ({ @@ -45,9 +52,35 @@ export class Preferences extends React.Component { ]); } + onTabChange = (tabId: PreferencesTab) => { + this.activeTab = tabId; + }; + + renderNavigation() { + return ( + +
Preferences
+ + + +
+ ); + } + render() { const { preferences } = userStore; - const header =

Preferences

; let defaultShell = process.env.SHELL || process.env.PTYSHELL; if (!defaultShell) { @@ -59,18 +92,14 @@ export class Preferences extends React.Component { } return ( - ( - -
-
-

Application

-
+ + {this.activeTab == PreferencesTab.Application && ( +

Appearance

@@ -130,7 +159,9 @@ export class Preferences extends React.Component { />
+ )} + {this.activeTab == PreferencesTab.Kubernetes && (

Kubernetes

@@ -144,7 +175,9 @@ export class Preferences extends React.Component {
+ )} + {this.activeTab == PreferencesTab.Extensions && (

Extensions

@@ -161,8 +194,8 @@ export class Preferences extends React.Component { ); })}
- - )}/> + )} + ); } }