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

Allow dynamic menu titles in 'WelcomeMenuRegistration' (#2752)

Signed-off-by: Alex Culliere <alozhkin@mirantis.com>

Co-authored-by: Alex Culliere <alozhkin@mirantis.com>
This commit is contained in:
Alex 2021-05-11 18:41:45 +03:00 committed by GitHub
parent cd1ed5a22b
commit 619b66c5d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import { BaseRegistry } from "./base-registry";
export interface WelcomeMenuRegistration {
title: string;
title: string | (() => string);
icon: string;
click: () => void | Promise<void>;
}

View File

@ -47,7 +47,7 @@ export class Welcome extends React.Component {
<ul className="box">
{ welcomeMenuRegistry.getItems().map((item, index) => (
<li key={index} className="flex grid-12" onClick={() => item.click()}>
<Icon material={item.icon} className="box col-1" /> <a className="box col-10">{item.title}</a> <Icon material="navigate_next" className="box col-1" />
<Icon material={item.icon} className="box col-1" /> <a className="box col-10">{typeof item.title === "string" ? item.title : item.title()}</a> <Icon material="navigate_next" className="box col-1" />
</li>
))}
</ul>