mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Minor refactoring of EditorTabBody
This commit is contained in:
@@ -13,21 +13,15 @@ interface Props {
|
||||
toolbarItems?: EditorToolbarView[];
|
||||
}
|
||||
|
||||
export enum ToolbarButtonType {
|
||||
Action = 'action',
|
||||
View = 'view',
|
||||
}
|
||||
|
||||
export interface EditorToolbarView {
|
||||
title?: string;
|
||||
heading?: string;
|
||||
imgSrc?: string;
|
||||
icon?: string;
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
render?: () => JSX.Element;
|
||||
action?: () => void;
|
||||
buttonType: ToolbarButtonType;
|
||||
btnType?: 'danger';
|
||||
}
|
||||
|
||||
interface State {
|
||||
@@ -87,7 +81,7 @@ export class EditorTabBody extends PureComponent<Props, State> {
|
||||
view.onClick();
|
||||
}
|
||||
|
||||
if (view.buttonType !== ToolbarButtonType.Action) {
|
||||
if (view.render) {
|
||||
this.onToggleToolBarView(view);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user