Skip to content

Commit 8633ba0

Browse files
committed
New interface for adding space panel items
1 parent 864a2dd commit 8633ba0

File tree

1 file changed

+16
-5
lines changed
  • packages/element-web-module-api/src/api

1 file changed

+16
-5
lines changed

packages/element-web-module-api/src/api/extras.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,31 @@ Please see LICENSE files in the repository root for full details.
77

88
import { JSX } from "react";
99

10-
interface SpacePanelItemProps {
11-
isPanelCollapsed: boolean;
12-
}
10+
/**
11+
* Any kind of event that can trigger a button
12+
* @alpha
13+
*/
14+
export type ButtonEvent = React.MouseEvent<Element> | React.KeyboardEvent<Element> | React.FormEvent<Element>;
1315

1416
/**
1517
* The type of the function used to render a space panel item.
1618
* @alpha
1719
*/
18-
export type SpacePanelItemRenderFunction = (props: SpacePanelItemProps) => JSX.Element;
20+
export interface SpacePanelItemProps {
21+
spaceKey?: string;
22+
className?: string;
23+
icon?: JSX.Element;
24+
label: string;
25+
contextMenuTooltip?: string;
26+
style?: React.CSSProperties;
27+
//notificationState?: NotificationState;
28+
onClick?(ev?: ButtonEvent): void;
29+
}
1930

2031
/**
2132
* API for inserting extra UI into Element Web.
2233
* @alpha Subject to change.
2334
*/
2435
export interface ExtrasApi {
25-
addSpacePanelItem(renderer: SpacePanelItemRenderFunction): void;
36+
addSpacePanelItem(props: SpacePanelItemProps): void;
2637
}

0 commit comments

Comments
 (0)