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:
parent
cd1ed5a22b
commit
619b66c5d5
@ -1,7 +1,7 @@
|
||||
import { BaseRegistry } from "./base-registry";
|
||||
|
||||
export interface WelcomeMenuRegistration {
|
||||
title: string;
|
||||
title: string | (() => string);
|
||||
icon: string;
|
||||
click: () => void | Promise<void>;
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user