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

Start first action on button click

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-04-27 12:02:19 +03:00
parent 2ba0a90cb5
commit 4efc584d46

View File

@ -45,6 +45,13 @@ export class CatalogAddButton extends React.Component<CatalogAddButtonProps> {
this.isOpen = false;
}
@autobind()
onButtonClick() {
if (this.menuItems.length == 1) {
this.menuItems[0].onClick();
}
}
render() {
if (this.menuItems.length === 0) {
return null;
@ -59,6 +66,7 @@ export class CatalogAddButton extends React.Component<CatalogAddButtonProps> {
onClose={this.onClose}
icon={<Icon material="add" />}
direction="up"
onClick={this.onButtonClick}
>
{ this.menuItems.map((menuItem, index) => {
return <SpeedDialAction