mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
page-layout: fixes + reuse in cluster-setttings and preferences pages
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
2e662e834b
commit
22653bd1f9
@ -1,87 +1,51 @@
|
|||||||
.ClusterSettings {
|
.ClusterSettings {
|
||||||
.WizardLayout {
|
$spacing: $padding * 3;
|
||||||
grid-template-columns: unset;
|
|
||||||
grid-template-rows: 76px 1fr;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
.head-col {
|
> .content-wrapper {
|
||||||
justify-content: space-between;
|
--flex-gap: #{$spacing};
|
||||||
|
}
|
||||||
|
|
||||||
:nth-child(2) {
|
// TODO: move sub-component styles to separate files
|
||||||
flex: 1 0 0;
|
.admin-note {
|
||||||
}
|
font-size: small;
|
||||||
}
|
opacity: 0.5;
|
||||||
|
margin-left: $margin;
|
||||||
|
}
|
||||||
|
|
||||||
.content-col {
|
.button-area {
|
||||||
margin: 0;
|
margin-top: $margin * 2;
|
||||||
padding-top: $padding * 3;
|
}
|
||||||
background-color: $clusterSettingsBackground;
|
|
||||||
|
|
||||||
.SubTitle {
|
.file-loader {
|
||||||
text-transform: none;
|
margin-top: $margin * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
> div {
|
.status-table {
|
||||||
margin-top: $margin * 5;
|
margin: $spacing 0;
|
||||||
}
|
|
||||||
|
|
||||||
.admin-note {
|
.Table {
|
||||||
font-size: small;
|
border: 1px solid var(--drawerSubtitleBackground);
|
||||||
opacity: 0.5;
|
border-radius: $radius;
|
||||||
margin-left: $margin;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-area {
|
.TableRow {
|
||||||
margin-top: $margin * 2;
|
&:not(:last-of-type) {
|
||||||
}
|
border-bottom: 1px solid var(--drawerSubtitleBackground);
|
||||||
|
}
|
||||||
|
|
||||||
.file-loader {
|
.value {
|
||||||
margin-top: $margin * 2;
|
flex-grow: 2;
|
||||||
}
|
word-break: break-word;
|
||||||
|
color: var(--textColorSecondary);
|
||||||
|
}
|
||||||
|
|
||||||
.hint {
|
.link {
|
||||||
font-size: smaller;
|
@include pseudo-link;
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
p + p, .hint + p {
|
|
||||||
padding-top: $padding;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-table {
|
|
||||||
margin: $margin * 3 0;
|
|
||||||
|
|
||||||
.Table {
|
|
||||||
border: 1px solid var(--drawerSubtitleBackground);
|
|
||||||
border-radius: $radius;
|
|
||||||
|
|
||||||
.TableRow {
|
|
||||||
&:not(:last-of-type) {
|
|
||||||
border-bottom: 1px solid var(--drawerSubtitleBackground);
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
flex-grow: 2;
|
|
||||||
word-break: break-word;
|
|
||||||
color: var(--textColorSecondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.link {
|
|
||||||
@include pseudo-link;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.Input, .Select {
|
.Input, .Select {
|
||||||
margin-top: 10px;
|
margin-top: $padding;
|
||||||
}
|
|
||||||
|
|
||||||
.Select {
|
|
||||||
&__control {
|
|
||||||
box-shadow: 0 0 0 1px $borderFaintColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,21 +1,19 @@
|
|||||||
import "./cluster-settings.scss";
|
import "./cluster-settings.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer, disposeOnUnmount } from "mobx-react";
|
import { autorun } from "mobx";
|
||||||
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { Features } from "./features";
|
import { Features } from "./features";
|
||||||
import { Removal } from "./removal";
|
import { Removal } from "./removal";
|
||||||
import { Status } from "./status";
|
import { Status } from "./status";
|
||||||
import { General } from "./general";
|
import { General } from "./general";
|
||||||
import { Cluster } from "../../../main/cluster";
|
import { Cluster } from "../../../main/cluster";
|
||||||
import { WizardLayout } from "../layout/wizard-layout";
|
|
||||||
import { ClusterIcon } from "../cluster-icon";
|
import { ClusterIcon } from "../cluster-icon";
|
||||||
import { Icon } from "../icon";
|
|
||||||
import { navigate } from "../../navigation";
|
|
||||||
import { IClusterSettingsRouteParams } from "./cluster-settings.route";
|
import { IClusterSettingsRouteParams } from "./cluster-settings.route";
|
||||||
import { clusterStore } from "../../../common/cluster-store";
|
import { clusterStore } from "../../../common/cluster-store";
|
||||||
import { RouteComponentProps } from "react-router";
|
import { RouteComponentProps } from "react-router";
|
||||||
import { clusterIpc } from "../../../common/cluster-ipc";
|
import { clusterIpc } from "../../../common/cluster-ipc";
|
||||||
import { autorun } from "mobx";
|
import { PageLayout } from "../layout/page-layout";
|
||||||
|
|
||||||
interface Props extends RouteComponentProps<IClusterSettingsRouteParams> {
|
interface Props extends RouteComponentProps<IClusterSettingsRouteParams> {
|
||||||
}
|
}
|
||||||
@ -27,7 +25,6 @@ export class ClusterSettings extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
window.addEventListener('keydown', this.onEscapeKey);
|
|
||||||
disposeOnUnmount(this,
|
disposeOnUnmount(this,
|
||||||
autorun(() => {
|
autorun(() => {
|
||||||
this.refreshCluster();
|
this.refreshCluster();
|
||||||
@ -35,51 +32,29 @@ export class ClusterSettings extends React.Component<Props> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
window.removeEventListener('keydown', this.onEscapeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
onEscapeKey = (evt: KeyboardEvent) => {
|
|
||||||
if (evt.code === "Escape") {
|
|
||||||
evt.stopPropagation();
|
|
||||||
this.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshCluster = async () => {
|
refreshCluster = async () => {
|
||||||
if(this.cluster) {
|
if (this.cluster) {
|
||||||
await clusterIpc.activate.invokeFromRenderer(this.cluster.id);
|
await clusterIpc.activate.invokeFromRenderer(this.cluster.id);
|
||||||
clusterIpc.refresh.invokeFromRenderer(this.cluster.id);
|
clusterIpc.refresh.invokeFromRenderer(this.cluster.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
|
||||||
navigate("/");
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const cluster = this.cluster
|
const cluster = this.cluster
|
||||||
if (!cluster) return null;
|
if (!cluster) return null;
|
||||||
const header = (
|
const header = (
|
||||||
<>
|
<>
|
||||||
<ClusterIcon
|
<ClusterIcon cluster={cluster} showErrors={false} showTooltip={false}/>
|
||||||
cluster={cluster}
|
|
||||||
showErrors={false}
|
|
||||||
showTooltip={false}
|
|
||||||
/>
|
|
||||||
<h2>{cluster.preferences.clusterName}</h2>
|
<h2>{cluster.preferences.clusterName}</h2>
|
||||||
<Icon material="close" onClick={this.close} big/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div className="ClusterSettings">
|
<PageLayout className="ClusterSettings" header={header}>
|
||||||
<WizardLayout header={header} centered>
|
<Status cluster={cluster}></Status>
|
||||||
<Status cluster={cluster}></Status>
|
<General cluster={cluster}></General>
|
||||||
<General cluster={cluster}></General>
|
<Features cluster={cluster}></Features>
|
||||||
<Features cluster={cluster}></Features>
|
<Removal cluster={cluster}></Removal>
|
||||||
<Removal cluster={cluster}></Removal>
|
</PageLayout>
|
||||||
</WizardLayout>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,10 +41,10 @@ export class ClusterHomeDirSetting extends React.Component<Props> {
|
|||||||
onBlur={this.save}
|
onBlur={this.save}
|
||||||
placeholder="$HOME"
|
placeholder="$HOME"
|
||||||
/>
|
/>
|
||||||
<span className="hint">
|
<small className="hint">
|
||||||
An explicit start path where the terminal will be launched,{" "}
|
An explicit start path where the terminal will be launched,{" "}
|
||||||
this is used as the current working directory (cwd) for the shell process.
|
this is used as the current working directory (cwd) for the shell process.
|
||||||
</span>
|
</small>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,7 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
|
|||||||
}}
|
}}
|
||||||
options={options}
|
options={options}
|
||||||
/>
|
/>
|
||||||
<span className="hint">What query format is used to fetch metrics from Prometheus</span>
|
<small className="hint">What query format is used to fetch metrics from Prometheus</small>
|
||||||
{this.canEditPrometheusPath && (
|
{this.canEditPrometheusPath && (
|
||||||
<>
|
<>
|
||||||
<p>Prometheus service address.</p>
|
<p>Prometheus service address.</p>
|
||||||
@ -101,10 +101,10 @@ export class ClusterPrometheusSetting extends React.Component<Props> {
|
|||||||
onBlur={this.onSavePath}
|
onBlur={this.onSavePath}
|
||||||
placeholder="<namespace>/<service>:<port>"
|
placeholder="<namespace>/<service>:<port>"
|
||||||
/>
|
/>
|
||||||
<span className="hint">
|
<small className="hint">
|
||||||
An address to an existing Prometheus installation{" "}
|
An address to an existing Prometheus installation{" "}
|
||||||
({'<namespace>/<service>:<port>'}). Lens tries to auto-detect address if left empty.
|
({'<namespace>/<service>:<port>'}). Lens tries to auto-detect address if left empty.
|
||||||
</span>
|
</small>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -1,60 +1,24 @@
|
|||||||
.Preferences {
|
.Preferences {
|
||||||
position: fixed!important; // Allows to cover ClustersMenu
|
$spacing: $padding * 2;
|
||||||
z-index: 1;
|
|
||||||
|
|
||||||
.WizardLayout {
|
.repos {
|
||||||
grid-template-columns: unset;
|
position: relative;
|
||||||
grid-template-rows: 76px 1fr;
|
|
||||||
padding: 0;
|
|
||||||
|
|
||||||
.content-col {
|
.Badge {
|
||||||
padding: $padding * 8 0;
|
display: flex;
|
||||||
background-color: $clusterSettingsBackground;
|
margin: 0;
|
||||||
|
margin-bottom: 1px;
|
||||||
h2 {
|
padding: $padding $spacing;
|
||||||
margin-bottom: $margin * 2;
|
|
||||||
|
|
||||||
&:not(:first-child) {
|
|
||||||
margin-top: $margin * 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.SubTitle {
|
|
||||||
text-transform: none;
|
|
||||||
margin: 0!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.repos {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.Badge {
|
|
||||||
display: flex;
|
|
||||||
margin: 0;
|
|
||||||
margin-bottom: 1px;
|
|
||||||
padding: $padding $padding * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.hint {
|
|
||||||
margin-top: -$margin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-mac & {
|
.extensions {
|
||||||
.WizardLayout .head-col {
|
h2 {
|
||||||
padding-top: 32px;
|
margin: $spacing 0;
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.Icon {
|
|
||||||
margin-top: -$margin * 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.Select {
|
&:empty {
|
||||||
&__control {
|
display: none;
|
||||||
box-shadow: 0 0 0 1px $borderFaintColor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
import "./preferences.scss"
|
import "./preferences.scss"
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { action, computed, observable } from "mobx";
|
import { action, computed, observable } from "mobx";
|
||||||
import { t, Trans } from "@lingui/macro";
|
import { t, Trans } from "@lingui/macro";
|
||||||
import { _i18n } from "../../i18n";
|
import { _i18n } from "../../i18n";
|
||||||
import { WizardLayout } from "../layout/wizard-layout";
|
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { Select, SelectOption } from "../select";
|
import { Select, SelectOption } from "../select";
|
||||||
import { userStore } from "../../../common/user-store";
|
import { userStore } from "../../../common/user-store";
|
||||||
@ -14,10 +14,10 @@ import { Checkbox } from "../checkbox";
|
|||||||
import { Notifications } from "../notifications";
|
import { Notifications } from "../notifications";
|
||||||
import { Badge } from "../badge";
|
import { Badge } from "../badge";
|
||||||
import { themeStore } from "../../theme.store";
|
import { themeStore } from "../../theme.store";
|
||||||
import { history } from "../../navigation";
|
|
||||||
import { Tooltip } from "../tooltip";
|
import { Tooltip } from "../tooltip";
|
||||||
import { KubectlBinaries } from "./kubectl-binaries";
|
import { KubectlBinaries } from "./kubectl-binaries";
|
||||||
import { appPreferenceRegistry } from "../../../extensions/app-preference-registry";
|
import { appPreferenceRegistry } from "../../../extensions/app-preference-registry";
|
||||||
|
import { PageLayout } from "../layout/page-layout";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Preferences extends React.Component {
|
export class Preferences extends React.Component {
|
||||||
@ -41,21 +41,9 @@ export class Preferences extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
window.addEventListener('keydown', this.onEscapeKey);
|
|
||||||
await this.loadHelmRepos();
|
await this.loadHelmRepos();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
window.removeEventListener('keydown', this.onEscapeKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
onEscapeKey = (evt: KeyboardEvent) => {
|
|
||||||
if (evt.code === "Escape") {
|
|
||||||
evt.stopPropagation();
|
|
||||||
history.goBack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
async loadHelmRepos() {
|
async loadHelmRepos() {
|
||||||
this.helmLoading = true;
|
this.helmLoading = true;
|
||||||
@ -115,91 +103,86 @@ export class Preferences extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { preferences } = userStore;
|
const { preferences } = userStore;
|
||||||
const extensionPreferences = appPreferenceRegistry.preferences
|
const extensionPreferences = appPreferenceRegistry.preferences;
|
||||||
const header = (
|
const header = <h2><Trans>Preferences</Trans></h2>;
|
||||||
<>
|
|
||||||
<h2>Preferences</h2>
|
|
||||||
<Icon material="close" big onClick={history.goBack}/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<div className="Preferences">
|
<PageLayout showOnTop className="Preferences" header={header}>
|
||||||
<WizardLayout header={header} centered>
|
<h2><Trans>Color Theme</Trans></h2>
|
||||||
<h2><Trans>Color Theme</Trans></h2>
|
<Select
|
||||||
<Select
|
options={this.themeOptions}
|
||||||
options={this.themeOptions}
|
value={preferences.colorTheme}
|
||||||
value={preferences.colorTheme}
|
onChange={({ value }: SelectOption) => preferences.colorTheme = value}
|
||||||
onChange={({ value }: SelectOption) => preferences.colorTheme = value}
|
/>
|
||||||
/>
|
|
||||||
|
|
||||||
<h2><Trans>HTTP Proxy</Trans></h2>
|
<h2><Trans>HTTP Proxy</Trans></h2>
|
||||||
<Input
|
<Input
|
||||||
theme="round-black"
|
theme="round-black"
|
||||||
placeholder={_i18n._(t`Type HTTP proxy url (example: http://proxy.acme.org:8080)`)}
|
placeholder={_i18n._(t`Type HTTP proxy url (example: http://proxy.acme.org:8080)`)}
|
||||||
value={this.httpProxy}
|
value={this.httpProxy}
|
||||||
onChange={v => this.httpProxy = v}
|
onChange={v => this.httpProxy = v}
|
||||||
onBlur={() => preferences.httpsProxy = this.httpProxy}
|
onBlur={() => preferences.httpsProxy = this.httpProxy}
|
||||||
/>
|
/>
|
||||||
<small className="hint">
|
<small className="hint">
|
||||||
<Trans>Proxy is used only for non-cluster communication.</Trans>
|
<Trans>Proxy is used only for non-cluster communication.</Trans>
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
<KubectlBinaries preferences={preferences} />
|
<KubectlBinaries preferences={preferences}/>
|
||||||
|
|
||||||
<h2><Trans>Helm</Trans></h2>
|
<h2><Trans>Helm</Trans></h2>
|
||||||
<Select
|
<Select
|
||||||
placeholder={<Trans>Repositories</Trans>}
|
placeholder={<Trans>Repositories</Trans>}
|
||||||
isLoading={this.helmLoading}
|
isLoading={this.helmLoading}
|
||||||
isDisabled={this.helmLoading}
|
isDisabled={this.helmLoading}
|
||||||
options={this.helmOptions}
|
options={this.helmOptions}
|
||||||
onChange={this.onRepoSelect}
|
onChange={this.onRepoSelect}
|
||||||
formatOptionLabel={this.formatHelmOptionLabel}
|
formatOptionLabel={this.formatHelmOptionLabel}
|
||||||
controlShouldRenderValue={false}
|
controlShouldRenderValue={false}
|
||||||
/>
|
/>
|
||||||
<div className="repos flex gaps column">
|
<div className="repos flex gaps column">
|
||||||
{Array.from(this.helmAddedRepos).map(([name, repo]) => {
|
{Array.from(this.helmAddedRepos).map(([name, repo]) => {
|
||||||
const tooltipId = `message-${name}`;
|
const tooltipId = `message-${name}`;
|
||||||
return (
|
|
||||||
<Badge key={name} className="added-repo flex gaps align-center justify-space-between">
|
|
||||||
<span id={tooltipId} className="repo">{name}</span>
|
|
||||||
<Icon
|
|
||||||
material="delete"
|
|
||||||
onClick={() => this.removeRepo(repo)}
|
|
||||||
tooltip={<Trans>Remove</Trans>}
|
|
||||||
/>
|
|
||||||
<Tooltip targetId={tooltipId} formatters={{ narrow: true }}>
|
|
||||||
{repo.url}
|
|
||||||
</Tooltip>
|
|
||||||
</Badge>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2><Trans>Certificate Trust</Trans></h2>
|
|
||||||
<Checkbox
|
|
||||||
label={<Trans>Allow untrusted Certificate Authorities</Trans>}
|
|
||||||
value={preferences.allowUntrustedCAs}
|
|
||||||
onChange={v => preferences.allowUntrustedCAs = v}
|
|
||||||
/>
|
|
||||||
<small className="hint">
|
|
||||||
<Trans>This will make Lens to trust ANY certificate authority without any validations.</Trans>{" "}
|
|
||||||
<Trans>Needed with some corporate proxies that do certificate re-writing.</Trans>{" "}
|
|
||||||
<Trans>Does not affect cluster communications!</Trans>
|
|
||||||
</small>
|
|
||||||
|
|
||||||
{extensionPreferences.map(({title, components: { Hint, Input}}) => {
|
|
||||||
return (
|
return (
|
||||||
<div key={title}>
|
<Badge key={name} className="added-repo flex gaps align-center justify-space-between">
|
||||||
|
<span id={tooltipId} className="repo">{name}</span>
|
||||||
|
<Icon
|
||||||
|
material="delete"
|
||||||
|
onClick={() => this.removeRepo(repo)}
|
||||||
|
tooltip={<Trans>Remove</Trans>}
|
||||||
|
/>
|
||||||
|
<Tooltip targetId={tooltipId} formatters={{ narrow: true }}>
|
||||||
|
{repo.url}
|
||||||
|
</Tooltip>
|
||||||
|
</Badge>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2><Trans>Certificate Trust</Trans></h2>
|
||||||
|
<Checkbox
|
||||||
|
label={<Trans>Allow untrusted Certificate Authorities</Trans>}
|
||||||
|
value={preferences.allowUntrustedCAs}
|
||||||
|
onChange={v => preferences.allowUntrustedCAs = v}
|
||||||
|
/>
|
||||||
|
<small className="hint">
|
||||||
|
<Trans>This will make Lens to trust ANY certificate authority without any validations.</Trans>{" "}
|
||||||
|
<Trans>Needed with some corporate proxies that do certificate re-writing.</Trans>{" "}
|
||||||
|
<Trans>Does not affect cluster communications!</Trans>
|
||||||
|
</small>
|
||||||
|
|
||||||
|
<div className="extensions flex column gaps">
|
||||||
|
{extensionPreferences.map(({ title, components: { Hint, Input } }, index) => {
|
||||||
|
return (
|
||||||
|
<div key={index} className="preference">
|
||||||
<h2>{title}</h2>
|
<h2>{title}</h2>
|
||||||
<Input />
|
<Input/>
|
||||||
<small className="hint">
|
<small className="hint">
|
||||||
<Hint />
|
<Hint/>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</WizardLayout>
|
</div>
|
||||||
</div>
|
</PageLayout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { PageLayout } from "../layout/page-layout";
|
|||||||
export class Support extends React.Component {
|
export class Support extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<PageLayout fullScreen className="Support" header={<h2>Support</h2>}>
|
<PageLayout showOnTop className="Support" header={<h2>Support</h2>}>
|
||||||
<h2><Trans>Community Slack Channel</Trans></h2>
|
<h2><Trans>Community Slack Channel</Trans></h2>
|
||||||
<p>
|
<p>
|
||||||
<Trans>Ask a question, see what's being discussed, join the conversation <a className="supportLink" href={slackUrl} target="_blank">here</a></Trans>{" "}
|
<Trans>Ask a question, see what's being discussed, join the conversation <a className="supportLink" href={slackUrl} target="_blank">here</a></Trans>{" "}
|
||||||
|
|||||||
@ -6,21 +6,21 @@
|
|||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-rows: min-content 1fr;
|
grid-template-rows: min-content 1fr;
|
||||||
|
|
||||||
// global page, covers whole app screen
|
// covers whole app view area
|
||||||
&.global {
|
&.top {
|
||||||
position: fixed !important; // allow to cover ClustersMenu
|
position: fixed !important; // allow to cover ClustersMenu
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
|
// adds extra space for traffic-light top buttons (mac only)
|
||||||
|
.is-mac & > .header {
|
||||||
|
padding-top: $spacing * 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> .header {
|
> .header {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
padding: $spacing;
|
padding: $spacing;
|
||||||
background-color: $layoutTabsBackground;
|
background-color: $layoutTabsBackground;
|
||||||
|
|
||||||
// add extra spacing for traffic-light top buttons (mac only)
|
|
||||||
.is-mac & {
|
|
||||||
padding-top: $spacing * 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
> .content-wrapper {
|
> .content-wrapper {
|
||||||
@ -47,6 +47,15 @@
|
|||||||
color: $colorInfo;
|
color: $colorInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.SubTitle {
|
||||||
|
text-transform: none;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
|
||||||
|
+ * + .hint {
|
||||||
|
margin-top: -$padding / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.Select {
|
.Select {
|
||||||
&__control {
|
&__control {
|
||||||
box-shadow: 0 0 0 1px $borderFaintColor;
|
box-shadow: 0 0 0 1px $borderFaintColor;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import "./page-layout.scss"
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { cssNames, IClassName } from "../../utils";
|
import { autobind, cssNames, IClassName } from "../../utils";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { navigation } from "../../navigation";
|
import { navigation } from "../../navigation";
|
||||||
|
|
||||||
@ -13,7 +13,8 @@ export interface PageLayoutProps extends React.DOMAttributes<any> {
|
|||||||
contentClass?: IClassName;
|
contentClass?: IClassName;
|
||||||
provideBackButtonNavigation?: boolean;
|
provideBackButtonNavigation?: boolean;
|
||||||
contentGaps?: boolean;
|
contentGaps?: boolean;
|
||||||
fullScreen?: boolean; // covers whole app view
|
showOnTop?: boolean; // covers whole app view
|
||||||
|
back?: (evt: React.MouseEvent | KeyboardEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultProps: Partial<PageLayoutProps> = {
|
const defaultProps: Partial<PageLayoutProps> = {
|
||||||
@ -25,7 +26,14 @@ const defaultProps: Partial<PageLayoutProps> = {
|
|||||||
export class PageLayout extends React.Component<PageLayoutProps> {
|
export class PageLayout extends React.Component<PageLayoutProps> {
|
||||||
static defaultProps = defaultProps as object;
|
static defaultProps = defaultProps as object;
|
||||||
|
|
||||||
back = () => navigation.goBack();
|
@autobind()
|
||||||
|
back(evt?: React.MouseEvent | KeyboardEvent) {
|
||||||
|
if (this.props.back) {
|
||||||
|
this.props.back(evt);
|
||||||
|
} else {
|
||||||
|
navigation.goBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
window.addEventListener('keydown', this.onEscapeKey);
|
window.addEventListener('keydown', this.onEscapeKey);
|
||||||
@ -41,17 +49,18 @@ export class PageLayout extends React.Component<PageLayoutProps> {
|
|||||||
}
|
}
|
||||||
if (evt.code === "Escape") {
|
if (evt.code === "Escape") {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
this.back();
|
this.back(evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
className, contentClass, header, headerClass, provideBackButtonNavigation,
|
contentClass, header, headerClass, provideBackButtonNavigation,
|
||||||
contentGaps, fullScreen, children, ...elemProps
|
contentGaps, showOnTop, children, ...elemProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
const className = cssNames("PageLayout", { top: showOnTop }, this.props.className);
|
||||||
return (
|
return (
|
||||||
<div {...elemProps} className={cssNames("PageLayout", className, { global: fullScreen })}>
|
<div {...elemProps} className={className}>
|
||||||
<div className={cssNames("header flex gaps align-center", headerClass)}>
|
<div className={cssNames("header flex gaps align-center", headerClass)}>
|
||||||
{header}
|
{header}
|
||||||
{provideBackButtonNavigation && (
|
{provideBackButtonNavigation && (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user