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
32 changed files with 1369 additions and 464 deletions

View File

@@ -0,0 +1,22 @@
import React from "react";
export type SidebarProps<P = {}> = {
children: React.ReactNode;
/**
* Called on sidebar close (either by user action or by the editor).
*/
onClose?: () => void | boolean;
/** if not supplied, sidebar won't be dockable */
onDock?: (docked: boolean) => void;
docked?: boolean;
dockable?: boolean;
className?: string;
} & P;
export type SidebarPropsContextValue = Pick<
SidebarProps,
"onClose" | "onDock" | "docked" | "dockable"
>;
export const SidebarPropsContext =
React.createContext<SidebarPropsContextValue>({});