mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix top-bar extension render errors
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
d14a3e4a6d
commit
55f35466df
@ -219,6 +219,34 @@ export default class ExampleExtension extends Renderer.LensExtension {
|
||||
|
||||
```
|
||||
|
||||
### Top Bar Items
|
||||
|
||||
This extension can register custom components to a top bar area.
|
||||
|
||||
```typescript
|
||||
import React from "react";
|
||||
import { Renderer } from "@k8slens/extensions";
|
||||
|
||||
const {
|
||||
Component: {
|
||||
Icon,
|
||||
}
|
||||
} = Renderer;
|
||||
|
||||
export default class ExampleExtension extends Renderer.LensExtension {
|
||||
topBarItems = [
|
||||
{
|
||||
components: {
|
||||
Item: (
|
||||
<Icon material="favorite" onClick={() => this.navigate("/example-page" />
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
### Status Bar Items
|
||||
|
||||
This extension can register custom icons and text to a status bar area.
|
||||
|
||||
@ -23,7 +23,7 @@ import type React from "react";
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
|
||||
interface TopBarComponents {
|
||||
Item?: React.ComponentType;
|
||||
Item: React.ComponentType;
|
||||
}
|
||||
|
||||
export interface TopBarRegistration {
|
||||
|
||||
@ -45,7 +45,7 @@ export const TopBar = observer(({ label, children, ...rest }: Props) => {
|
||||
|
||||
return (
|
||||
<div key={index}>
|
||||
{registration.components.Item}
|
||||
<registration.components.Item />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user