Refactor
This commit is contained in:
@@ -47,12 +47,8 @@ export function ExtensionToolbarItem({ compact }: Props) {
|
||||
isOpen={isActive}
|
||||
title={component.title}
|
||||
onClick={() => {
|
||||
const appEvents = getAppEvents();
|
||||
if (isActive) {
|
||||
appEvents.publish(new CloseExtensionSidebarEvent());
|
||||
} else {
|
||||
appEvents.publish(new OpenExtensionSidebarEvent({ pluginId, componentTitle: component.title }));
|
||||
}
|
||||
const event = isActive ? new CloseExtensionSidebarEvent() : new OpenExtensionSidebarEvent({ pluginId, componentTitle: component.title });
|
||||
getAppEvents().publish(event);
|
||||
}}
|
||||
pluginId={pluginId}
|
||||
/>
|
||||
@@ -70,12 +66,8 @@ export function ExtensionToolbarItem({ compact }: Props) {
|
||||
active={dockedComponentId === id}
|
||||
label={c.title}
|
||||
onClick={() => {
|
||||
const appEvents = getAppEvents();
|
||||
if (dockedComponentId === id) {
|
||||
appEvents.publish(new CloseExtensionSidebarEvent());
|
||||
} else {
|
||||
appEvents.publish(new OpenExtensionSidebarEvent({ pluginId, componentTitle: c.title }));
|
||||
}
|
||||
const event = dockedComponentId === id ? new CloseExtensionSidebarEvent() : new OpenExtensionSidebarEvent({ pluginId, componentTitle: c.title });
|
||||
getAppEvents().publish(event);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user