feat: refactor Sidebar into standalone reusable component (#5663)

🚀!
This commit is contained in:
David Luzar 2022-10-17 12:25:24 +02:00 committed by GitHub
parent fdc462ec01
commit e9067de173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 1369 additions and 464 deletions

View file

@ -140,6 +140,9 @@ export type AppState = {
| "backgroundColorPicker"
| "strokeColorPicker"
| null;
openSidebar: "library" | "customSidebar" | null;
isSidebarDocked: boolean;
lastPointerDownWith: PointerType;
selectedElementIds: { [id: string]: boolean };
previousSelectedElementIds: { [id: string]: boolean };
@ -161,8 +164,6 @@ export type AppState = {
offsetTop: number;
offsetLeft: number;
isLibraryOpen: boolean;
isLibraryMenuDocked: boolean;
fileHandle: FileSystemHandle | null;
collaborators: Map<string, Collaborator>;
showStats: boolean;
@ -313,6 +314,10 @@ export interface ExcalidrawProps {
pointerDownState: PointerDownState,
) => void;
onScrollChange?: (scrollX: number, scrollY: number) => void;
/**
* Render function that renders custom <Sidebar /> component.
*/
renderSidebar?: () => JSX.Element | null;
}
export type SceneData = {
@ -368,6 +373,7 @@ export type AppProps = Merge<
detectScroll: boolean;
handleKeyboardGlobally: boolean;
isCollaborating: boolean;
children?: React.ReactNode;
}
>;
@ -479,6 +485,7 @@ export type ExcalidrawImperativeAPI = {
setActiveTool: InstanceType<typeof App>["setActiveTool"];
setCursor: InstanceType<typeof App>["setCursor"];
resetCursor: InstanceType<typeof App>["resetCursor"];
toggleMenu: InstanceType<typeof App>["toggleMenu"];
};
export type Device = Readonly<{