You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
2 years ago
|
import React from "react";
|
||
2 years ago
|
import { AppState, SidebarName, SidebarTabName } from "../../types";
|
||
|
|
||
|
export type SidebarTriggerProps = {
|
||
|
name: SidebarName;
|
||
|
tab?: SidebarTabName;
|
||
|
icon?: JSX.Element;
|
||
|
children?: React.ReactNode;
|
||
|
title?: string;
|
||
|
className?: string;
|
||
|
onToggle?: (open: boolean) => void;
|
||
|
style?: React.CSSProperties;
|
||
|
};
|
||
2 years ago
|
|
||
|
export type SidebarProps<P = {}> = {
|
||
2 years ago
|
name: SidebarName;
|
||
2 years ago
|
children: React.ReactNode;
|
||
|
/**
|
||
2 years ago
|
* Called on sidebar open/close or tab change.
|
||
|
*/
|
||
|
onStateChange?: (state: AppState["openSidebar"]) => void;
|
||
|
/**
|
||
|
* supply alongside `docked` prop in order to make the Sidebar user-dockable
|
||
2 years ago
|
*/
|
||
|
onDock?: (docked: boolean) => void;
|
||
|
docked?: boolean;
|
||
|
className?: string;
|
||
2 years ago
|
// NOTE sidebars we use internally inside the editor must have this flag set.
|
||
|
// It indicates that this sidebar should have lower precedence over host
|
||
|
// sidebars, if both are open.
|
||
|
/** @private internal */
|
||
|
__fallback?: boolean;
|
||
2 years ago
|
} & P;
|
||
|
|
||
|
export type SidebarPropsContextValue = Pick<
|
||
|
SidebarProps,
|
||
2 years ago
|
"onDock" | "docked"
|
||
|
> & { onCloseRequest: () => void; shouldRenderDockButton: boolean };
|
||
2 years ago
|
|
||
|
export const SidebarPropsContext =
|
||
2 years ago
|
React.createContext<SidebarPropsContextValue>({} as SidebarPropsContextValue);
|