1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Allowing any item for StatusBarRegistration (#1143)

* Adding extension's label text next to Icon

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Removing unused registerStatusBarItem()

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2020-10-26 17:29:54 +03:00 committed by GitHub
parent 9b9bf47970
commit e9ebd06664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 20 deletions

View File

@ -21,15 +21,17 @@ export default class SupportPageRendererExtension extends LensRendererExtension
) )
} }
registerStatusBarIcon(registry: Registry.StatusBarRegistry) { registerStatusBarItem(registry: Registry.StatusBarRegistry) {
this.disposers.push( this.disposers.push(
registry.add({ registry.add({
icon: ( item: (
<Component.Icon <div
material="support" className="flex align-center gaps hover-highlight"
tooltip="Support"
onClick={() => Navigation.navigate(supportPageURL())} onClick={() => Navigation.navigate(supportPageURL())}
/> >
<Component.Icon material="help_outline" small />
<span>Support</span>
</div>
) )
}) })
) )

View File

@ -47,7 +47,7 @@ export class ExtensionLoader {
instance.registerGlobalPage(globalPageRegistry) instance.registerGlobalPage(globalPageRegistry)
instance.registerAppPreferences(appPreferenceRegistry) instance.registerAppPreferences(appPreferenceRegistry)
instance.registerClusterFeatures(clusterFeatureRegistry) instance.registerClusterFeatures(clusterFeatureRegistry)
instance.registerStatusBarIcon(statusBarRegistry) instance.registerStatusBarItem(statusBarRegistry)
}) })
} }

View File

@ -1,16 +1,11 @@
import { LensExtension } from "./lens-extension" import { LensExtension } from "./lens-extension"
import type { MenuRegistry } from "./registries/menu-registry"; import type { MenuRegistry } from "./registries/menu-registry";
import type { StatusBarRegistry } from "./registries/status-bar-registry";
export class LensMainExtension extends LensExtension { export class LensMainExtension extends LensExtension {
registerAppMenus(registry: MenuRegistry) { registerAppMenus(registry: MenuRegistry) {
// //
} }
registerStatusBarIcon(registry: StatusBarRegistry) {
//
}
registerPrometheusProviders(registry: any) { registerPrometheusProviders(registry: any) {
// //
} }

View File

@ -18,7 +18,7 @@ export class LensRendererExtension extends LensExtension {
return return
} }
registerStatusBarIcon(registry: StatusBarRegistry) { registerStatusBarItem(registry: StatusBarRegistry) {
return return
} }

View File

@ -4,7 +4,7 @@ import React from "react";
import { BaseRegistry } from "./base-registry"; import { BaseRegistry } from "./base-registry";
export interface StatusBarRegistration { export interface StatusBarRegistration {
icon?: React.ReactNode; item?: React.ReactNode;
} }
export class StatusBarRegistry extends BaseRegistry<StatusBarRegistration> { export class StatusBarRegistry extends BaseRegistry<StatusBarRegistration> {

View File

@ -1,13 +1,27 @@
.BottomBar { .BottomBar {
$spacing: $padding / 2; $spacing: $padding / 2;
--flex-gap: #{$spacing};
font-size: $font-size-small; font-size: $font-size-small;
background-color: #3d90ce; background-color: #3d90ce;
padding: $padding / 4 $padding; padding: 0 $padding;
color: white; color: white;
#current-workspace { #current-workspace {
--flex-gap: #{$spacing}; padding: $padding / 4 $padding / 2;
cursor: pointer; cursor: pointer;
} }
.hover-highlight {
&:hover {
background-color: #ffffff33;
cursor: pointer;
}
}
.extensions {
> * {
padding: $padding / 4 $padding / 2;
}
}
} }

View File

@ -13,7 +13,7 @@ export class BottomBar extends React.Component {
const { currentWorkspace } = workspaceStore; const { currentWorkspace } = workspaceStore;
return ( return (
<div className="BottomBar flex gaps"> <div className="BottomBar flex gaps">
<div id="current-workspace" className="flex gaps align-center"> <div id="current-workspace" className="flex gaps align-center hover-highlight">
<Icon small material="layers"/> <Icon small material="layers"/>
<span className="workspace-name">{currentWorkspace.name}</span> <span className="workspace-name">{currentWorkspace.name}</span>
</div> </div>
@ -21,9 +21,9 @@ export class BottomBar extends React.Component {
htmlFor="current-workspace" htmlFor="current-workspace"
/> />
<div className="extensions box grow flex gaps justify-flex-end"> <div className="extensions box grow flex gaps justify-flex-end">
{statusBarRegistry.getItems().map(({ icon }, index) => { {statusBarRegistry.getItems().map(({ item }, index) => {
if (!icon) return; if (!item) return;
return <React.Fragment key={index}>{icon}</React.Fragment> return <React.Fragment key={index}>{item}</React.Fragment>
})} })}
</div> </div>
</div> </div>