mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-29 08:56:52 +00:00
afacde4041
* Fix AddTableEntityPanel * Add CSS * Fix snapshot
19 lines
669 B
TypeScript
19 lines
669 B
TypeScript
import create, { UseStore } from "zustand";
|
|
|
|
export interface SidePanelState {
|
|
isOpen: boolean;
|
|
panelWidth: string;
|
|
panelContent?: JSX.Element;
|
|
headerText?: string;
|
|
openSidePanel: (headerText: string, panelContent: JSX.Element, panelWidth?: string, onClose?: () => void) => void;
|
|
closeSidePanel: () => void;
|
|
}
|
|
|
|
export const useSidePanel: UseStore<SidePanelState> = create((set) => ({
|
|
isOpen: false,
|
|
panelWidth: "440px",
|
|
openSidePanel: (headerText, panelContent, panelWidth = "440px") =>
|
|
set((state) => ({ ...state, headerText, panelContent, panelWidth, isOpen: true })),
|
|
closeSidePanel: () => set((state) => ({ ...state, isOpen: false })),
|
|
}));
|