import React from 'react'; import { LayoutContext, layoutContext, SidebarSection } from './layout-context'; export const LayoutProvider: React.FC = ({ children, }) => { const [openedTableInSidebar, setOpenedTableInSidebar] = React.useState< string | undefined >(); const [openedRelationshipInSidebar, setOpenedRelationshipInSidebar] = React.useState(); const [selectedSidebarSection, setSelectedSidebarSection] = React.useState('tables'); const [isSidePanelShowed, setIsSidePanelShowed] = React.useState(false); const closeAllTablesInSidebar: LayoutContext['closeAllTablesInSidebar'] = () => setOpenedTableInSidebar(''); const closeAllRelationshipsInSidebar: LayoutContext['closeAllRelationshipsInSidebar'] = () => setOpenedRelationshipInSidebar(''); const hideSidePanel: LayoutContext['hideSidePanel'] = () => setIsSidePanelShowed(false); const showSidePanel: LayoutContext['showSidePanel'] = () => setIsSidePanelShowed(true); return ( {children} ); };