Minor refactoring of EditorTabBody

This commit is contained in:
Torkel Ödegaard
2019-01-04 12:38:50 +01:00
parent f749ced36e
commit e0c28ba770
4 changed files with 22 additions and 20 deletions

View File

@@ -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);
}
};